> Subject: Re: [PATCH v7 4/4] pinctrl: Implementation of the generic scmi- > pinctrl driver > > On Tue, Apr 02, 2024 at 10:22:24AM +0800, Peng Fan (OSS) wrote: > > From: Peng Fan <peng.fan@xxxxxxx> > > > > scmi-pinctrl driver implements pinctrl driver interface and using SCMI > > protocol to redirect messages from pinctrl subsystem SDK to SCMI > > platform firmware, which does the changes in HW. > > ... > > > +#include <linux/device.h> > > +#include <linux/err.h> > > +#include <linux/module.h> > > +#include <linux/seq_file.h> > > +#include <linux/scmi_protocol.h> > > +#include <linux/slab.h> > > Missing headers. Not sure there is an easy way to filter out what is missed. > > ... > > > + *p_groups = (const char * const *)func->groups; > > Is this casting needed? This is no needed. > > ... > > > +static int pinctrl_scmi_pinconf_get(struct pinctrl_dev *pctldev, > > + unsigned int _pin, unsigned long *config) > > Why underscored parameter name? Underscore could be dropped. > > ... > > > +static int pinctrl_scmi_get_pins(struct scmi_pinctrl *pmx, > > + struct pinctrl_desc *desc) > > +{ > > + struct pinctrl_pin_desc *pins; > > + unsigned int npins; > > + int ret, i; > > + > > + npins = pinctrl_ops->count_get(pmx->ph, PIN_TYPE); > > + /* > > + * npins will never be zero, the scmi pinctrl driver has bailed out > > + * if npins is zero. > > + */ > > This is fragile, but at least it is documented. > > > + pins = devm_kmalloc_array(pmx->dev, npins, sizeof(*pins), > GFP_KERNEL); > > + if (!pins) > > + return -ENOMEM; > > + > > + for (i = 0; i < npins; i++) { > > + pins[i].number = i; > > + ret = pinctrl_ops->name_get(pmx->ph, i, PIN_TYPE, > &pins[i].name); > > + if (ret) > > How does the cleanup work for the previously assigned pin names? Is it > needed? No need. The "name" memory region is allocated in firmware pinctrl Protocol init phase. > Maybe a comment? ok. As below. /* * The region for name is handled by the scmi firmware driver, * no need free here */ > > > + return dev_err_probe(pmx->dev, ret, > > + "Can't get name for pin %d", i); > > + } > > + > > + desc->npins = npins; > > + desc->pins = pins; > > + dev_dbg(pmx->dev, "got pins %u", npins); > > + > > + return 0; > > +} > > ... > > > +static const struct scmi_device_id scmi_id_table[] = { > > + { SCMI_PROTOCOL_PINCTRL, "pinctrl" }, > > + { } > > +}; > > +MODULE_DEVICE_TABLE(scmi, scmi_id_table); > > Move this closer to the user. ok. Fix in v8. Thanks, Peng. > > -- > With Best Regards, > Andy Shevchenko >