Re: [PATCH v2 3/4] gpio: adp5585: Add Analog Devices ADP5585 support

From: Andy Shevchenko
Date: Tue May 28 2024 - 15:36:17 EST


Tue, May 28, 2024 at 10:03:13PM +0300, Laurent Pinchart kirjoitti:
> From: Haibo Chen <haibo.chen@xxxxxxx>
>
> The ADP5585 is a 10/11 input/output port expander with a built in keypad
> matrix decoder, programmable logic, reset generator, and PWM generator.
> This driver supports the GPIO function using the platform device
> registered by the core MFD driver.
>
> The driver is derived from an initial implementation from NXP, available
> in commit 451f61b46b76 ("MLK-25917-2 gpio: adp5585-gpio: add
> adp5585-gpio support") in their BSP kernel tree. It has been extensively
> rewritten.

Why is this not using gpio-regmap?

..

> +#include <linux/device.h>
> +#include <linux/gpio/driver.h>
> +#include <linux/mfd/adp5585.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>

+ types.h

..

> + bit = off * 2 + (off > 5 ? 4 : 0);

Right, but can you use >= 6 here which immediately follows to the next
question, i.e. why not use bank in this conditional?

..

> + struct adp5585_dev *adp5585 = dev_get_drvdata(pdev->dev.parent);

(see below)

> + struct adp5585_gpio_dev *adp5585_gpio;
> + struct device *dev = &pdev->dev;

struct adp5585_dev *adp5585 = dev_get_drvdata(dev->parent);

> + struct gpio_chip *gc;
> + int ret;

..

> + platform_set_drvdata(pdev, adp5585_gpio);

Any use of driver data?

..

> + device_set_of_node_from_dev(dev, dev->parent);

Why not device_set_node()?

--
With Best Regards,
Andy Shevchenko