Re: [PATCH RFC 3/3] leds: Add driver for the ISSI IS31FL32xx family of LED drivers

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

 




On Tue, Feb 23, 2016 at 01:17:25PM -0500, David Rivshin (Allworx) wrote:
> From: David Rivshin <drivshin@xxxxxxxxxxx>
> +static int is31fl32xx_parse_child_dt(const struct device *dev,
> +				     const struct device_node *child,
> +				     struct is31fl32xx_led_data *led_data)
> +{
> +	struct led_classdev *cdev = &led_data->cdev;
> +	int ret = 0;
> +	u32 reg;
> +
> +	cdev->name = of_get_property(child, "label", NULL) ? : child->name;

We really shouldn't be spreading of_get_property into more drivers. It's
generally not what you want, and doesn't do appropriate sanity checking.

Use of_property_read_string, though you may need to copy the result.

> +
> +	ret = of_property_read_u32(child, "reg", &reg);
> +	if (ret || reg < 1 || reg > led_data->priv->cdef->channels) {
> +		dev_err(dev,
> +			"Child node %s does not have a valid reg property\n",
> +			child->name);
> +		return -EINVAL;
> +	}
> +	led_data->channel = reg;
> +
> +	cdev->default_trigger = of_get_property(child, "linux,default-trigger",
> +						NULL);

Likewise.

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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux