Re: [PATCH 4/4] staging: dwc2: load parameters from the devicetree

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

 



Hi Marc,

> >  /** > > + * dwc2_load_property() - Load a single property from the devicetree
> > + * node into the given variable.
> > + *
> > + * @dev: Platform device
> > + * @res: The variable to put the loaded value into
> > + * @name: The name of the devicetree property to load
> > + */
> > +static void dwc2_load_property(struct platform_device *dev, int *res,
> > +			       const char *name)
> > +{
> > +	int len;
> > +	const u32 *val;
> > +
> > +	val = of_get_property(dev->dev.of_node, name, &len);
> > +	if (!val)
> > +		return;
> > +
> > +	if (len != sizeof(*val)) {
> > +		dev_warn(&dev->dev,
> > +			 "Invalid value in devicetree for %s property, should be a single integer\n",
> > +			 name);
> > +		return;
> > +	}
> > +
> > +	*res = be32_to_cpu(*val);
> 
> What about using of_property_read_u32() instead of open coding it here?

Apparently I missed that function while looking through of.h, I'll
convert the code. Thanks for pointing it out!

Gr.

Matthijs
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux