lkml.org 
[lkml]   [2023]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 char-misc-next] misc: microchip: pci1xxxx: Add OTP/EEPROM driver for the pci1xxxx switch
On Mon, Mar 13, 2023 at 04:01:15PM +0000, VaibhaavRam.TL@microchip.com wrote:
> > Again, default group will handle this automatically, you should never
> > need to call a sysfs_*() call from a driver. Otherwise something is usually very wrong.
>
> Are you recommending similar to this snippet?
>
> static struct bin_attribute *pci1xxxx_bin_attributes[] = {
> &pci1xxxx_otp_attr,
> &pci1xxxx_eeprom_attr
> NULL,
> };
>
> static const struct attribute_group pci1xxxx_bin_attributes_group = {
> .bin_attrs = pci1xxxx_bin_attributes,
> };
> ..
> ..
> auxiliary_device.device.attribute_group = pci1xxxx_bin_attributes_group

Yes.

> This creates sysfs for both EEPROM and OTP at once and handles for its removal, right?
> But, In this case, I have to check whether EEPROM is responsive and only then create sysfs for it.
>
> Can you please provide some guidance, on how to handle this situation without using sysfs_*().

Use the "is_visible" callback in your group to tell the driver core if
the specific attribute needs to be created or not.

thanks,

greg k-h

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