Re: [PATCH v7 03/11] pinctrl: Add MAX7360 pinctrl driver
From: Mathieu Dubois-Briand
Date: Fri May 02 2025 - 08:36:57 EST
On Fri May 2, 2025 at 12:15 PM CEST, Andy Shevchenko wrote:
> On Mon, Apr 28, 2025 at 01:57:21PM +0200, Mathieu Dubois-Briand wrote:
>> Add driver for Maxim Integrated MAX7360 pinctrl on the PORT pins. Pins
>> can be used either for GPIO, PWM or rotary encoder functionalities.
>
>> +struct max7360_pinctrl {
>> + struct pinctrl_dev *pctldev;
>> + struct pinctrl_desc pinctrl_desc;
>
> Does`pahole` agree with your choice of layout?
>
I believe so. `pahole drivers/pinctrl/pinctrl-max7360.ko` says:
struct max7360_pinctrl {
struct pinctrl_dev * pctldev; /* 0 4 */
struct pinctrl_desc pinctrl_desc; /* 4 44 */
/* XXX last struct has 3 bytes of padding */
/* size: 48, cachelines: 1, members: 2 */
/* paddings: 1, sum paddings: 3 */
/* last cacheline: 48 bytes */
};
>> + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
>> + if (!chip)
>> + return -ENOMEM;
>> +
>> + pd = &chip->pinctrl_desc;
>> +
>> + pd->pctlops = &max7360_pinctrl_ops;
>> + pd->pmxops = &max7360_pmxops;
>> + pd->name = dev_name(dev);
>> + pd->pins = max7360_pins;
>> + pd->npins = MAX7360_MAX_GPIO;
>> + pd->owner = THIS_MODULE;
>> +
>> + device_set_of_node_from_dev(dev, dev->parent);
>
> I don't like this, but I have no better idea right now. Perhaps add a comment
> on top to explain this call?
>
I'm adding this comment here, and a similar one in the PWM driver.
/*
* This MFD sub-device does not have any associated device tree node:
* properties are stored in the device node of the parent (MFD) device
* and this same node is used in phandles of client devices.
* Reuse this device tree node here, as otherwise the pinctrl subsystem
* would be confused by this topology.
*/
OK for all other comments.
Thanks for your review.
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com