public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: VaibhaavRam.TL@microchip.com
Cc: arnd@arndb.de, Kumaravel.Thiagarajan@microchip.com,
	linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com,
	Tharunkumar.Pasumarthi@microchip.com
Subject: Re: [PATCH v7 char-misc-next] misc: microchip: pci1xxxx: Add OTP/EEPROM driver for the pci1xxxx switch
Date: Mon, 13 Mar 2023 17:16:59 +0100	[thread overview]
Message-ID: <ZA9Me2d9IsoYGifp@kroah.com> (raw)
In-Reply-To: <DM4PR11MB62385D0541F7AF8EC7E9F6CE97B99@DM4PR11MB6238.namprd11.prod.outlook.com>

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

  reply	other threads:[~2023-03-13 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230303170426.353-1-vaibhaavram.tl@microchip.com>
2023-03-09 10:55 ` [PATCH v7 char-misc-next] misc: microchip: pci1xxxx: Add OTP/EEPROM driver for the pci1xxxx switch Greg KH
2023-03-13 16:01   ` VaibhaavRam.TL
2023-03-13 16:16     ` Greg KH [this message]
2023-03-15  9:07       ` VaibhaavRam.TL
2023-03-15 11:32         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZA9Me2d9IsoYGifp@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Kumaravel.Thiagarajan@microchip.com \
    --cc=Tharunkumar.Pasumarthi@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=VaibhaavRam.TL@microchip.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox