lkml.org 
[lkml]   [2023]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 4/4] wiegand: add Wiegand GPIO bit-banged controller driver
On Thu, Feb 02, 2023 at 03:33:05PM +0100, Martin Zaťovič wrote:
> +/*
> + * Attribute file for setting payload length of Wiegand messages.
> + */
> +ssize_t payload_len_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct wiegand_gpio *wiegand_gpio = (struct wiegand_gpio *)
> + dev->driver_data;

No need to cast.


> +
> + device_create_file(dev, &dev_attr_payload_len);

No, just add an attribute group pointer to your driver and the driver
core will add/remove the sysfs attributes automatically. No need to do
it manually at all.

thanks,

greg k-h

\
 
 \ /
  Last update: 2023-03-27 00:08    [W:0.094 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site