History log of /linux-master/drivers/gpio/gpio-max730x.c
Revision Date Author Comments
# 6c826061 05-Dec-2023 Randy Dunlap <rdunlap@infradead.org>

gpio: max730x: don't use kernel-doc marker for regular comment

Use a common C comment (/*) instead of kernel-doc notation to prevent
warnings from scripts/kernel-doc.

gpio-max730x.c:3: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
gpio-max730x.c:3: warning: missing initial short description on line:
* Copyright (C) 2006 Juergen Beisert, Pengutronix

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


# 06de2cd7 12-Oct-2021 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

gpio: max730x: Make __max730x_remove() return void

An spi or i2c remove callback is only called for devices that probed
successfully. In this case this implies that __max730x_probe() set a
non-NULL driver data. So the check ts == NULL is never true. With this
check dropped, __max730x_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>


# 47a3734b 14-May-2020 Rodrigo Alencar <455.rodrigo.alencar@gmail.com>

gpio: max730x: bring gpiochip_add_data after port config

gpiochip_add_data being called before might cause premature calls of
the gpiochip operations before the port_config values are initialized,
which would possibily write zeros to port configuration registers,
an operation not allowed. For example, if there are gpio-hog nodes
in a device-tree, the sequence of function calls are performed

gpiochip_add_data
of_gpiochip_add
of_gpiochip_scan_gpios
of_gpiochip_add_hog
gpiod_hog
gpiochip_request_own_desc
gpiod_configure_flags
gpiod_direction_output/gpiod_direction_input

which would call later the gpiochip operation direction_output or
direction_input prior the port_config[] initialization.

Moreover, gpiochip_get_data is replaced by the container_of macro
inside the gpiochip operations, which would allow the calling of
max7301_direction_input prior to gpiochip_add_data

Signed-off-by: Rodrigo Alencar <455.rodrigo.alencar@gmail.com>
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 25424b86 13-Apr-2018 Linus Walleij <linus.walleij@linaro.org>

gpio: max730x: Include the right header

This is a driver so only include <linux/gpio/driver.h>.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 6f4deb18 08-Aug-2016 Christophe Leroy <christophe.leroy@c-s.fr>

gpio: max730x: set gpiochip data pointer before using it

gpiochip_add_data() has to be called before calling
max7301_direction_input()

[ 4.389883] Unable to handle kernel paging request for data at address 0x00000018
[ 4.397282] Faulting instruction address: 0xc01a8cbc
[ 4.402023] Oops: Kernel access of bad area, sig: 11 [#1]
[ 4.407331] PREEMPT CMPC885
[ 4.410131] CPU: 0 PID: 6 Comm: kworker/u2:0 Not tainted 4.5.0-gacdfdee #39
[ 4.418592] Workqueue: deferwq deferred_probe_work_func
[ 4.423711] task: c60798b0 ti: c608a000 task.ti: c608a000
[ 4.429038] NIP: c01a8cbc LR: c01a8e24 CTR: c01ff028
[ 4.433953] REGS: c608bad0 TRAP: 0300 Not tainted (4.5.0-s3k-dev-gacdfdee-svn-dirty)
[ 4.441847] MSR: 00009032 <EE,ME,IR,DR,RI> CR: 33039553 XER: a000f940
[ 4.448395] DAR: 00000018 DSISR: c0000000
GPR00: c01a8e24 c608bb80 c60798b0 c60d6f6c 00000004 00000002 07de2900 00700000
GPR08: 00000000 00000000 c608a000 00001032 35039553 00000000 c002f37c c6010b64
GPR16: c6010a48 c6010a14 c6010a00 00000000 c0450000 c0453568 c0453438 c050db14
GPR24: c62662bc 00000009 ffffffaa c60d6f5d 00000001 00000000 00000000 00000000
[ 4.480371] NIP [c01a8cbc] max7301_direction_input+0x20/0x9c
[ 4.485951] LR [c01a8e24] __max730x_probe+0xec/0x138
[ 4.490812] Call Trace:
[ 4.493268] [c608bba0] [c01a8e24] __max730x_probe+0xec/0x138
[ 4.498878] [c608bbc0] [c01cc368] driver_probe_device+0x190/0x38c
[ 4.504895] [c608bbf0] [c01ca918] bus_for_each_drv+0x58/0xb4
[ 4.510489] [c608bc20] [c01cc04c] __device_attach+0x8c/0x110
[ 4.516082] [c608bc50] [c01cab80] bus_probe_device+0x34/0xb8
[ 4.521673] [c608bc70] [c01c96c8] device_add+0x3c0/0x598
[ 4.526925] [c608bcb0] [c0200f90] spi_add_device+0x114/0x160
[ 4.532512] [c608bcd0] [c02018d0] spi_register_master+0x6e0/0x7c8
[ 4.538537] [c608bd20] [c02019fc] devm_spi_register_master+0x44/0x8c
[ 4.544824] [c608bd40] [c0203854] of_fsl_spi_probe+0x458/0x57c
[ 4.550587] [c608bda0] [c01cd828] platform_drv_probe+0x30/0x74
[ 4.556366] [c608bdb0] [c01cc368] driver_probe_device+0x190/0x38c
[ 4.562383] [c608bde0] [c01ca918] bus_for_each_drv+0x58/0xb4
[ 4.567977] [c608be10] [c01cc04c] __device_attach+0x8c/0x110
[ 4.573572] [c608be40] [c01cab80] bus_probe_device+0x34/0xb8
[ 4.579170] [c608be60] [c01cb9b4] deferred_probe_work_func+0xa4/0xc4
[ 4.585438] [c608be80] [c0029c04] process_one_work+0x22c/0x414
[ 4.591201] [c608bea0] [c002a100] worker_thread+0x314/0x5c0
[ 4.596722] [c608bef0] [c002f444] kthread+0xc8/0xcc
[ 4.601538] [c608bf40] [c000af84] ret_from_kernel_thread+0x5c/0x64
[ 4.607596] Instruction dump:
[ 4.610530] 7c0803a6 bba10014 38210020 4e800020 7c0802a6 9421ffe0 38840004 bf810010
[ 4.618188] 90010024 549cf0be 83c30010 549d0f7c <813e0018> 7fc3f378 7d3f2430 57ff07fe
[ 4.626041] ---[ end trace 303adb021dd4caf2 ]---

Cc: stable@vger.kernel.org
fixes: 5e45e01916197 ("gpio: max730x: use gpiochip data pointer")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 5e45e019 07-Dec-2015 Linus Walleij <linus.walleij@linaro.org>

gpio: max730x: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Roland Stigge <stigge@antcom.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 58383c78 04-Nov-2015 Linus Walleij <linus.walleij@linaro.org>

gpio: change member .dev to .parent

The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.

This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:

@@
struct gpio_chip *var;
@@
-var->dev
+var->parent

and:

@@
struct gpio_chip var;
@@
-var.dev
+var.parent

and:

@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent

Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.

This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Alek Du <alek.du@intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 7474f23d 26-Sep-2015 Julia Lawall <Julia.Lawall@lip6.fr>

gpio: max730x: eliminate double free

The function __max730x_remove is called from the remove functions of
drivers/gpio/gpio-max7300.c and drivers/gpio/gpio-max7301.c. In both
cases, the probe function allocates ts using devm_kzalloc. Explicitly
freeing such a value with kfree will cause a double free.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 9f5132ae 12-Jul-2014 abdoulaye berthe <berthe.ab@gmail.com>

gpio: remove all usage of gpio_remove retval in driver/gpio

Signed-off-by: abdoulaye berthe <berthe.ab@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# b6d71fdb 14-Apr-2014 Axel Lin <axel.lin@ingics.com>

gpio: max730x: Remove kfree(ts) in __max730x_remove()

The memory for ts is allocated by devm_kzalloc now, so the kfree is not
required.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Juergen Beisert <jbe@pengutronix.de>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# db04030a 20-Dec-2013 Sachin Kamat <sachin.kamat@linaro.org>

gpio: max730x: Remove redundant dev_set_drvdata

Driver core sets it to NULL upon probe failure or release.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 9fb1f39e 04-Dec-2013 Linus Walleij <linus.walleij@linaro.org>

gpio/pinctrl: make gpio_chip members typed boolean

This switches the two members of struct gpio_chip that were
defined as unsigned foo:1 to bool, because that is indeed what
they are. Switch all users in the gpio and pinctrl subsystems
to assign these values with true/false instead of 0/1. The
users outside these subsystems will survive since true/false
is 1/0, atleast we set some kind of more strict typing example.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# e56aee18 30-Jul-2013 Jingoo Han <jg1.han@samsung.com>

gpio: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 206210ce 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

gpio: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Peter Tyser <ptyser@xes-inc.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3836309d 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

gpio: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8754fccb 15-Nov-2012 Roland Stigge <stigge@antcom.de>

gpio: gpio-max710x: Support device tree probing

For probing via device tree, we need to support the case without platform_data.
In this case, chip.base is set to -1 for automatic numbering.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# c103de24 04-Jun-2011 Grant Likely <grant.likely@secretlab.ca>

gpio: reorganize drivers

Sort the gpio makefile and enforce the naming convention gpio-*.c for
gpio drivers.

v2: cleaned up filenames in Kconfig and comment blocks
v3: fixup use of BASIC_MMIO to GENERIC_GPIO for mxc

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>