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: Wed, 15 Mar 2023 12:32:20 +0100 [thread overview]
Message-ID: <ZBGsxNwKxcdyoq7v@kroah.com> (raw)
In-Reply-To: <DM4PR11MB6238653CE39A429E4B10B9C497BF9@DM4PR11MB6238.namprd11.prod.outlook.com>
On Wed, Mar 15, 2023 at 09:07:12AM +0000, VaibhaavRam.TL@microchip.com wrote:
>
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Monday, March 13, 2023 9:47 PM
> To: VaibhaavRam TL - I69105 <VaibhaavRam.TL@microchip.com>
> Subject: Re: [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.
>
> I have added "is_bin_visible" callback and it is working fine. Sysfs for EEPROM and OTP is created inside drivers folder
It should be for the device, not the driver, are you sure you are using
the right groups pointer?
> But I have used attribute group inside device_driver under auxiliary_driver structure.
> as opposed to what I have mentioned previously because , struct device_driver is exposed to me instead of struct device.
> Since there can be only one instance of driver for multiple devices, I cannot account for multiple instances of EEPROM/OTPs present in those devices.
Then your driver might be structured incorrectly, as the instance of the
device is what your driver binds to.
> Is it possible to use sysfs_create_group in this situation?
You should not need that at all, I really don't understand the problem,
sorry, can you post a patch that shows the issue?
thanks,
greg k-h
prev parent reply other threads:[~2023-03-15 11:33 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
2023-03-15 9:07 ` VaibhaavRam.TL
2023-03-15 11:32 ` Greg KH [this message]
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=ZBGsxNwKxcdyoq7v@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