Re: [PATCH net-next v5 10/17] net: pse-pd: Add support for PSE PIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Oleskij,

Thanks you for the review.

On Fri, 1 Mar 2024 15:24:07 +0100
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:

> > -static int of_pse_simple_xlate(struct pse_controller_dev *pcdev,
> > -			       const struct of_phandle_args *pse_spec)
> > +static int of_load_pse_pis(struct pse_controller_dev *pcdev)
> >  {
> > -	if (pse_spec->args[0] >= pcdev->nr_lines)
> > -		return -EINVAL;
> > +	struct device_node *np = pcdev->dev->of_node;
> > +	struct device_node *node, *pis;
> > +	int ret, i;
> >  
> > -	return pse_spec->args[0];
> > +	if (!np)
> > +		return -ENODEV;
> > +
> > +	pcdev->pi = kcalloc(pcdev->nr_lines, sizeof(*pcdev->pi),
> > GFP_KERNEL);
> > +	if (!pcdev->pi)
> > +		return -ENOMEM;
> > +
> > +	pis = of_get_child_by_name(np, "pse-pis");
> > +	if (!pis) {  
> 
> Do we need to allocate pcdev->pi if there are no pse-pis?

In fact it is not needed in this patch but in the patch 13 which use regulator
framework, as the regulator is described on each pi structure.

I will update them accordingly.

> > +		/* Legacy OF description of PSE PIs */
> > +		pcdev->of_legacy = true;  
> 
> It is not "legacy" :) PoDL do not providing definition of PSE PI since there
> is only one pair. May be: single_pair, no_pse_pi or any other idea.

You right it is not needed for PoDL. Maybe no_pse_pi is better according to the
following thoughts.

Just wondering, how a pse controller that support PoE and PoDL simultaneously
would be exposed in the binding. In that case I suppose all the PIs (PoE and
PoDL) need to use the pse-pi subnode. Then the "alternative pinout" and
"polarity" parameter would not be requested for PoDL PIs.

> > +			dev_err(pcdev->dev, "wrong id of pse pi: %u\n",
> > +				id);
> > +			ret = -EINVAL;
> > +			goto out;
> > +		}
> > +
> > +		ret = of_property_count_strings(node, "pairset-names");
> > +		if (ret <= 0)  
> 
> if (ret < 0)
>    error: can't get "pairset-names" property: %pe
> if (ret < 1 || ret > 2)
>    error: wrong number of pairset-names. Should be 1 or 2, got %i

Need to modify this to be able to have PoDL PIs without pairset description.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux