Skip to content

Commit 3e01775

Browse files
committed
gpio: bd7181x - compile fix - do not use dev from gpiochip
dev pointer was removed from struct gpiochip. Use gpiochip data instead of parent's devdata. At the same time we can use devm and drop the unnecessary remove. Untested - just fixing compilation. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
1 parent 98f1441 commit 3e01775

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

drivers/gpio/gpio-bd7181x.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#include <linux/init.h>
2424
#include <linux/kthread.h>
2525
#include <linux/irq.h>
26-
#include <linux/gpio.h>
26+
//#include <linux/gpio.h>
27+
#include <linux/gpio/driver.h>
2728
#include <linux/platform_device.h>
2829
#include <linux/of.h>
2930

@@ -40,7 +41,8 @@ static struct gpio_chip bd7181xgpo_chip;
4041
*/
4142
static int bd7181xgpo_get(struct gpio_chip *chip, unsigned offset)
4243
{
43-
struct bd7181x *bd7181x = dev_get_drvdata(chip->dev->parent);
44+
//struct bd7181x *bd7181x = dev_get_drvdata(chip->gpiodev->dev->parent);
45+
struct bd7181x *bd7181x = gpiochip_get_data(chip);
4446
int ret = 0;
4547

4648
ret = bd7181x_reg_read(bd7181x, BD7181X_REG_GPO);
@@ -72,7 +74,8 @@ static int bd7181xgpo_direction_out(struct gpio_chip *chip, unsigned offset,
7274
*/
7375
static void bd7181xgpo_set(struct gpio_chip *chip, unsigned offset, int value)
7476
{
75-
struct bd7181x *bd7181x = dev_get_drvdata(chip->dev->parent);
77+
//struct bd7181x *bd7181x = dev_get_drvdata(chip->gpiodev->dev->parent);
78+
struct bd7181x *bd7181x = gpiochip_get_data(chip);
7679
int ret;
7780
u8 gpoctl;
7881

@@ -155,9 +158,12 @@ static int gpo_bd7181x_probe(struct platform_device *pdev)
155158

156159
bd7181xgpo_chip.ngpio = 2; /* bd71815/bd71817 have 2 GPO */
157160

158-
bd7181xgpo_chip.dev = &pdev->dev;
161+
// bd7181xgpo_chip.dev = &pdev->dev;
162+
bd7181xgpo_chip.parent = pdev->dev.parent;
159163

160-
ret = gpiochip_add(&bd7181xgpo_chip);
164+
// ret = gpiochip_add(&bd7181xgpo_chip);
165+
ret = devm_gpiochip_add_data(&pdev->dev, &bd7181xgpo_chip,
166+
bd7181x);
161167
if (ret < 0) {
162168
dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
163169
bd7181xgpo_chip.ngpio = 0;
@@ -171,16 +177,6 @@ static int gpo_bd7181x_probe(struct platform_device *pdev)
171177
return ret;
172178
}
173179

174-
/** @brief remove bd7181x gpo device
175-
* @param pdev platfrom device pointer
176-
* @retval 0 success
177-
* @retval negative error number
178-
*/
179-
static int gpo_bd7181x_remove(struct platform_device *pdev)
180-
{
181-
return gpiochip_remove(&bd7181xgpo_chip);
182-
}
183-
184180
/* Note: this hardware lives inside an I2C-based multi-function device. */
185181
MODULE_ALIAS("platform:bd7181x-gpo");
186182

@@ -191,7 +187,6 @@ static struct platform_driver gpo_bd7181x_driver = {
191187
.owner = THIS_MODULE,
192188
},
193189
.probe = gpo_bd7181x_probe,
194-
.remove = gpo_bd7181x_remove,
195190
};
196191

197192
module_platform_driver(gpo_bd7181x_driver);

0 commit comments

Comments
 (0)