Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1532786
| From | Serge Semin <fancer.lancer@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver |
| Date | 2016-11-29 22:20 +0100 |
| Message-ID | <sIXYJ-5kl-21@gated-at.bofh.it> (permalink) |
| References | <snYd3-4NF-7@gated-at.bofh.it> <sICKB-89o-5@gated-at.bofh.it> <sICKB-89o-3@gated-at.bofh.it> <sIWpY-4eA-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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?
> > +/*
> > + * 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. To tell the truth macro BIN_ATTR_RW() isn't that
popular in the kernel. Neither is BIN_ATTR() macro, but it suites my driver
better than the another one.
Thanks,
-Sergey
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin <fancer.lancer@gmail.com> - 2016-11-28 23:40 +0100
[PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin <fancer.lancer@gmail.com> - 2016-11-28 23:40 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Greg KH <gregkh@linuxfoundation.org> - 2016-11-29 20:40 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin <fancer.lancer@gmail.com> - 2016-11-29 22:20 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Rob Herring <robh@kernel.org> - 2016-12-05 15:50 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin <fancer.lancer@gmail.com> - 2016-12-05 16:30 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Rob Herring <robh@kernel.org> - 2016-12-05 18:30 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin <fancer.lancer@gmail.com> - 2016-12-05 20:10 +0100
Re: [PATCH v2 2/2] eeprom: Add IDT 89HPESx driver bindings file Serge Semin <fancer.lancer@gmail.com> - 2016-12-09 03:00 +0100
Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Greg KH <gregkh@linuxfoundation.org> - 2016-11-29 20:40 +0100
Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin <fancer.lancer@gmail.com> - 2016-11-29 22:20 +0100
Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Greg KH <gregkh@linuxfoundation.org> - 2016-11-29 22:30 +0100
Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin <fancer.lancer@gmail.com> - 2016-11-29 22:50 +0100
Re: [PATCH v2 1/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Greg KH <gregkh@linuxfoundation.org> - 2016-11-29 20:40 +0100
[PATCH v3 2/2] eeprom: Add IDT 89HPESx driver dts-binding file Serge Semin <fancer.lancer@gmail.com> - 2016-11-29 23:30 +0100
[PATCH v3 0/2] eeprom: Add IDT 89HPESx EEPROM/CSR driver Serge Semin <fancer.lancer@gmail.com> - 2016-11-29 23:30 +0100
csiph-web