public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Steffen Eiden <seiden@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	Ingo Franzki <ifranzki@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Christoph Schlameuss <schlameuss@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>
Subject: Re: [PATCH v2 1/2] s390/uv: Refactor uv-sysfs creation
Date: Tue, 8 Oct 2024 16:33:08 +0200	[thread overview]
Message-ID: <20241008143308.27223-B-hca@linux.ibm.com> (raw)
In-Reply-To: <20241002160418.2424889-2-seiden@linux.ibm.com>

On Wed, Oct 02, 2024 at 06:04:17PM +0200, Steffen Eiden wrote:
> Streamline the sysfs generation to make it more extensible.
> Add a function to create a sysfs entry in the uv-sysfs dir.
> Use this function for the query directory.
> 
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
>  arch/s390/kernel/uv.c | 34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
...
> -static int __init uv_info_init(void)
> +static int __init uv_sysfs_dir_init(const struct attribute_group *grp,
> +				    struct kset **uv_dir_kset, const char *name)
> +{
> +	struct kset *kset;
> +	int rc = -ENOMEM;

rc is unnecessarily preinitialized, so you can wait for a cleanup
patch from some bot.

> +	kset = kset_create_and_add(name, NULL, uv_kobj);
> +	if (!kset)
> +		return -ENOMEM;
> +	*uv_dir_kset = kset;
> +
> +	rc = sysfs_create_group(&kset->kobj, grp);
> +	if (!rc)
> +		return 0;
> +
> +	kset_unregister(kset);
> +	return rc;

doing it like

	rc = sysfs_create_group(&kset->kobj, grp);
	if (rc)
		kset_unregister(kset);
	return rc;

is shorter ;)

  reply	other threads:[~2024-10-08 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 16:04 [PATCH v2 0/2] s390/uv: Provide host-key hashes in sysfs Steffen Eiden
2024-10-02 16:04 ` [PATCH v2 1/2] s390/uv: Refactor uv-sysfs creation Steffen Eiden
2024-10-08 14:33   ` Heiko Carstens [this message]
2024-10-02 16:04 ` [PATCH v2 2/2] s390/uv: Provide host-key hashes in sysfs Steffen Eiden
2024-10-08 12:12   ` Janosch Frank

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=20241008143308.27223-B-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=ifranzki@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schlameuss@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    /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