gpio: f7188: 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: Andreas Bofjall <andreas@gazonk.org> Cc: Simon Guinot <simon.guinot@sequanux.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
6219e7bba9
commit
f372d5f59c
|
@ -193,8 +193,7 @@ static struct f7188x_gpio_bank f71889_gpio_bank[] = {
|
||||||
static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
|
static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct f7188x_gpio_bank *bank =
|
struct f7188x_gpio_bank *bank = gpiochip_get_data(chip);
|
||||||
container_of(chip, struct f7188x_gpio_bank, chip);
|
|
||||||
struct f7188x_sio *sio = bank->data->sio;
|
struct f7188x_sio *sio = bank->data->sio;
|
||||||
u8 dir;
|
u8 dir;
|
||||||
|
|
||||||
|
@ -215,8 +214,7 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
|
||||||
static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset)
|
static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct f7188x_gpio_bank *bank =
|
struct f7188x_gpio_bank *bank = gpiochip_get_data(chip);
|
||||||
container_of(chip, struct f7188x_gpio_bank, chip);
|
|
||||||
struct f7188x_sio *sio = bank->data->sio;
|
struct f7188x_sio *sio = bank->data->sio;
|
||||||
u8 dir, data;
|
u8 dir, data;
|
||||||
|
|
||||||
|
@ -241,8 +239,7 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip,
|
||||||
unsigned offset, int value)
|
unsigned offset, int value)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct f7188x_gpio_bank *bank =
|
struct f7188x_gpio_bank *bank = gpiochip_get_data(chip);
|
||||||
container_of(chip, struct f7188x_gpio_bank, chip);
|
|
||||||
struct f7188x_sio *sio = bank->data->sio;
|
struct f7188x_sio *sio = bank->data->sio;
|
||||||
u8 dir, data_out;
|
u8 dir, data_out;
|
||||||
|
|
||||||
|
@ -270,8 +267,7 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip,
|
||||||
static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct f7188x_gpio_bank *bank =
|
struct f7188x_gpio_bank *bank = gpiochip_get_data(chip);
|
||||||
container_of(chip, struct f7188x_gpio_bank, chip);
|
|
||||||
struct f7188x_sio *sio = bank->data->sio;
|
struct f7188x_sio *sio = bank->data->sio;
|
||||||
u8 data_out;
|
u8 data_out;
|
||||||
|
|
||||||
|
@ -336,7 +332,7 @@ static int f7188x_gpio_probe(struct platform_device *pdev)
|
||||||
bank->chip.parent = &pdev->dev;
|
bank->chip.parent = &pdev->dev;
|
||||||
bank->data = data;
|
bank->data = data;
|
||||||
|
|
||||||
err = gpiochip_add(&bank->chip);
|
err = gpiochip_add_data(&bank->chip, bank);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"Failed to register gpiochip %d: %d\n",
|
"Failed to register gpiochip %d: %d\n",
|
||||||
|
|
Loading…
Reference in New Issue