Re: [PATCH 2/3] gpio: Add Intel USBIO GPIO driver

Sakari Ailus
2025-08-11T09:43:27Z

Hi Hans,

On Mon, Aug 11, 2025 at 11:23:50AM +0200, Hans de Goede wrote:
> Hi Sakari,
>
> Thank you for your review, note this
> is not a full reply.
>
> On 11-Aug-25 9:07 AM, Sakari Ailus wrote:
>
> ...
>
> >> +static int usbio_gpio_probe(struct auxiliary_device *adev,
> >> + const struct auxiliary_device_id *adev_id)
> >> +{
> >> + struct usbio_gpio_bank_desc *bank_desc;
> >> + struct device *dev = &adev->dev;
> >> + struct usbio_gpio *gpio;
> >> + int bank, ret;
> >> +
> >> + bank_desc = dev_get_platdata(dev);
> >> + if (!bank_desc)
> >> + return -EINVAL;
> >> +
> >> + gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL);
> >> + if (!gpio)
> >> + return -ENOMEM;
> >
> > All devm-allocated memory is released once the device is gone but you may
> > still have users. Could you release this in the adev's release callback
> > instead?
>
> All GPIO users go through gpio_descriptors which are seperately
> refcounted. The GPIO core can handle GPIO controllers being
> hot-unplugged since the end of 2023 and guarantees that no
> calls will be made to the gpiochip driver after calling
> gpiochip_remove().

Thanks, I wasn't aware of that. This simplifies the client driver
implementation nicely.

--
Regards,

Sakari Ailus