lkml.org 
[lkml]   [2019]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Qemu-devel] [PATCH] fw_cfg: use __ATTR_RO_MODE to define rev sysfs
On Wed, Feb 27, 2019 at 11:07:16AM +0800, Wei Yang wrote:
> On Tue, Feb 26, 2019 at 07:45:46PM +0100, Philippe Mathieu-Daudé wrote:
> >Hi Wei,
> >
> >On 2/26/19 8:31 AM, Wei Yang wrote:
> >> Leverage __ATTR_RO_MODE to define rev sysfs instead of using open code
> >> to define the attribute.
> >>
> >> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> >> ---
> >> drivers/firmware/qemu_fw_cfg.c | 13 ++++---------
> >> 1 file changed, 4 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
> >> index 039e0f91dba8..a1293cbd7adb 100644
> >> --- a/drivers/firmware/qemu_fw_cfg.c
> >> +++ b/drivers/firmware/qemu_fw_cfg.c
> >> @@ -296,18 +296,13 @@ static int fw_cfg_do_platform_probe(struct platform_device *pdev)
> >> return 0;
> >> }
> >>
> >> -static ssize_t fw_cfg_showrev(struct kobject *k, struct attribute *a, char *buf)
> >> +static ssize_t fw_cfg_rev_show(struct kobject *k, struct kobj_attribute *a,
> >> + char *buf)
> >> {
> >> return sprintf(buf, "%u\n", fw_cfg_rev);
> >> }
> >> -
> >> -static const struct {
> >> - struct attribute attr;
> >> - ssize_t (*show)(struct kobject *k, struct attribute *a, char *buf);
> >> -} fw_cfg_rev_attr = {
> >> - .attr = { .name = "rev", .mode = S_IRUSR },
> >> - .show = fw_cfg_showrev,
> >> -};
> >> +static const struct kobj_attribute fw_cfg_rev_attr =
> >> + __ATTR_RO_MODE(fw_cfg_rev, 0400);
> >
> >Why not keep S_IRUSR?
> >
>
> Because scripts/checkpatch.pl suggest not use S_IRUSR :-)
>
> I am not sure about the particular reason.

Oh yea.

http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com

maybe mention this in the commit log.

> >>
> >> /* fw_cfg_sysfs_entry type */
> >> struct fw_cfg_sysfs_entry {
> >>
>
> --
> Wei Yang
> Help you, Help me

\
 
 \ /
  Last update: 2019-02-27 14:56    [W:0.063 / U:3.780 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site