From: Serge Semin <fancer.lancer@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: srinivas.kandagatla@linaro.org, andrew@lunn.ch,
robh+dt@kernel.org, mark.rutland@arm.com,
Sergey.Semin@t-platforms.ru, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver
Date: Wed, 30 Nov 2016 00:45:11 +0300 [thread overview]
Message-ID: <20161129214511.GC9146@mobilestation> (raw)
In-Reply-To: <20161129212412.GA20334@kroah.com>
On Tue, Nov 29, 2016 at 10:24:12PM +0100, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Nov 30, 2016 at 12:16:25AM +0300, Serge Semin wrote:
> > On Tue, Nov 29, 2016 at 08:37:50PM +0100, Greg KH <gregkh@linuxfoundation.org> wrote:
> > > On Tue, Nov 29, 2016 at 01:38:20AM +0300, Serge Semin wrote:
> > > > +struct idt_89hpesx_dev {
> > > > + u32 eesize;
> > > > + bool eero;
> > > > + u8 eeaddr;
> > > > +
> > > > + u8 inieecmd;
> > > > + u8 inicsrcmd;
> > > > + u8 iniccode;
> > > > +
> > > > + atomic_t csr;
> > > > +
> > > > + int (*smb_write)(struct idt_89hpesx_dev *, const struct idt_smb_seq *);
> > > > + int (*smb_read)(struct idt_89hpesx_dev *, struct idt_smb_seq *);
> > > > + struct mutex smb_mtx;
> > > > +
> > > > + struct i2c_client *client;
> > > > +
> > > > + struct bin_attribute *ee_file;
> > > > + struct dentry *csr_dir;
> > > > + struct dentry *csr_file;
> > > > +};
> > > > +#define to_pdev_kobj(__kobj) \
> > > > + dev_get_drvdata(container_of(__kobj, struct device, kobj))
> > >
> > > Is it a struct device, or a kobject? This is totally confusing to me.
> > >
> > > And can't you just use kobj_to_dev()?
> > >
> >
> > I just didn't know about kobj_to_dev() inline function. Totally agree that
> > container_of() should be replaced with it.
> > What does look confusing to you? Do you mean the name "to_pdev_kobj" of the
> > macro?
>
> Yes, the macro is odd. As you are doing two different things here, just
> spell it out in the code and use kobj_to_dev() to make it easier to
> read please.
>
> > > > +/*
> > > > + * eeprom_attribute - EEPROM sysfs-node attributes
> > > > + *
> > > > + * NOTE Size will be changed in compliance with OF node. EEPROM attribute will
> > > > + * be read-only as well if the corresponding flag is specified in OF node.
> > > > + */
> > > > +BIN_ATTR(eeprom, 0644, idt_sysfs_eeprom_read, idt_sysfs_eeprom_write,
> > > > + EEPROM_DEF_SIZE);
> > >
> > > static?
> > >
> > > And BIN_ATTR_RW()?
> > >
> > > thanks,
> > >
> > > greg k-h
> >
> > Of course it should be static. Thanks for noticing that.
> > But I intentionally utilized BIN_ATTR() instead of BIN_ATTR_RW(), because
> > the last one implies to define the read/write methods with names
> > "_name##_read"/"_name##_write", which totally get out of naming within the
> > driver source code.
>
> That's ok, use the names the macro wants you to, that's the best way,
> and it ensures that I don't have to audit your permissions are correct
> for the file.
>
> > To tell the truth macro BIN_ATTR_RW() isn't that popular in the
> > kernel.
>
> Yes, but it should be, I have patches floating around somewhere to fix
> almost all of these up.
>
> > Neither is BIN_ATTR() macro, but it suites my driver better than the
> > another one.
>
> a "raw" BIN_ATTR() shouldn't be used either, please use the _RW()
> variant.
>
> thanks,
>
> greg k-h
Agreed with all the notes. I will send patchset v3 within next hour.
Thanks,
-Sergey
next prev parent reply other threads:[~2016-11-29 21:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-02 23:13 [PATCH] Add IDT 89HPESx EEPROM/CSR driver Serge Semin
2016-10-30 13:53 ` Greg KH
2016-11-24 18:42 ` Serge Semin
2016-11-28 22:38 ` [PATCH v2 0/2] eeprom: " Serge Semin
2016-11-28 22:38 ` [PATCH v2 1/2] " Serge Semin
2016-11-29 19:34 ` Greg KH
2016-11-29 19:37 ` Greg KH
2016-11-29 21:16 ` Serge Semin
2016-11-29 21:24 ` Greg KH
2016-11-29 21:45 ` Serge Semin [this message]
2016-11-28 22:38 ` [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin
2016-11-29 19:34 ` Greg KH
2016-11-29 21:15 ` Serge Semin
2016-12-05 14:46 ` Rob Herring
2016-12-05 15:25 ` Serge Semin
2016-12-05 17:27 ` Rob Herring
2016-12-05 19:04 ` Serge Semin
2016-12-09 1:57 ` Serge Semin
2016-12-12 23:04 ` Rob Herring
2016-12-13 14:08 ` Serge Semin
2016-11-29 22:27 ` [PATCH v3 0/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin
2016-11-29 22:27 ` [PATCH v3 1/2] " Serge Semin
2016-11-29 22:27 ` [PATCH v3 2/2] eeprom: Add IDT 89HPESx driver dts-binding file Serge Semin
2016-12-13 14:22 ` [PATCH v4 0/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin
2016-12-13 14:22 ` [PATCH v4 1/2] " Serge Semin
2017-01-11 8:21 ` Greg KH
2017-01-12 22:54 ` Serge Semin
2017-01-13 7:22 ` Greg KH
2017-01-13 9:47 ` Serge Semin
2016-12-13 14:22 ` [PATCH v4 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin
2017-01-13 12:16 ` [PATCH v5 0/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin
2017-01-13 12:16 ` [PATCH v5 1/2] " Serge Semin
2017-01-13 12:16 ` [PATCH v5 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin
2017-01-18 22:34 ` Rob Herring
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=20161129214511.GC9146@mobilestation \
--to=fancer.lancer@gmail.com \
--cc=Sergey.Semin@t-platforms.ru \
--cc=andrew@lunn.ch \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.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;
as well as URLs for NNTP newsgroup(s).