[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9efa9a4b-b0ce-f9b7-88b0-a74a767bbe81@linux.ibm.com>
Date: Sat, 7 Dec 2019 00:43:06 +0530
From: Sourabh Jain <sourabhjain@...ux.ibm.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: mpe@...erman.id.au, mahesh@...ux.vnet.ibm.com,
hbathini@...ux.ibm.com, linux-kernel@...r.kernel.org,
linuxppc-dev@...abs.org, corbet@....net, linux-doc@...r.kernel.org
Subject: Re: [PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_*
sysfs files
On 12/6/19 6:15 PM, Greg KH wrote:
> On Fri, Dec 06, 2019 at 05:54:31PM +0530, Sourabh Jain wrote:
>> +static struct kobj_attribute release_attr = __ATTR(release_mem,
>> 0200, NULL,
>> fadump_release_memory_store);
>> -static struct kobj_attribute fadump_attr = __ATTR(fadump_enabled,
>> +static struct kobj_attribute enable_attr = __ATTR(enabled,
>> 0444, fadump_enabled_show,
>> NULL);
>
> __ATTR_RO()?
>
>> -static struct kobj_attribute fadump_register_attr = __ATTR(fadump_registered,
>> +static struct kobj_attribute register_attr = __ATTR(registered,
>> 0644, fadump_register_show,
>> fadump_register_store);
>
> __ATTR_RW()?
Thanks I was not aware of these macros.
>
> And then use an ATTRIBUTE_GROUP() macro to create a group so that you
> then can do:
>
>> @@ -1452,11 +1450,47 @@ static void fadump_init_files(void)
>> printk(KERN_ERR "fadump: unable to create debugfs file"
>> " fadump_region\n");
>>
>> + rc = sysfs_create_file(fadump_kobj, &enable_attr.attr);
>> + if (rc)
>> + pr_err("unable to create enabled sysfs file (%d)\n",
>> + rc);
>> + rc = sysfs_create_file(fadump_kobj, ®ister_attr.attr);
>> + if (rc)
>> + pr_err("unable to create registered sysfs file (%d)\n",
>> + rc);
>> + if (fw_dump.dump_active) {
>> + rc = sysfs_create_file(fadump_kobj, &release_attr.attr);
>> + if (rc)
>> + pr_err("unable to create release_mem sysfs file (%d)\n",
>> + rc);
>> + }
>
> a single call to sysfs_create_groups() here instead of trying to unwind
> the mess if something went wrong.
>
Sure, I will replace the individual calls with a single group call.
Thanks,
Sourabh Jain
Powered by blists - more mailing lists