From: Greg KH <gregkh@linuxfoundation.org>
To: Thomas Renninger <trenn@suse.de>
Cc: linux-arch@vger.kernel.org,
Felix Schnizlein <fschnizlein@suse.de>,
Felix Schnizlein <fschnizlein@suse.com>,
x86@kernel.org, will.deacon@arm.com, linux@armlinux.org.uk,
linux-kernel@vger.kernel.org, fschnitzlein@suse.de,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] cpuinfo: add sysfs based arch independent cpuinfo framework
Date: Fri, 6 Dec 2019 17:33:58 +0100 [thread overview]
Message-ID: <20191206163358.GB86904@kroah.com> (raw)
In-Reply-To: <20191206162421.15050-2-trenn@suse.de>
On Fri, Dec 06, 2019 at 05:24:19PM +0100, Thomas Renninger wrote:
> --- /dev/null
> +++ b/drivers/base/cpuinfo.c
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright (C) 2017 SUSE Linux GmbH
> + * Written by: Felix Schnizlein <fschnizlein@suse.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + */
No SPDX line? And you can drop the license boilerplate text as well
too.
> +
> +#include <linux/cpu.h>
> +#include <linux/module.h>
> +#include <linux/cpuinfo.h>
> +
> +static struct attribute_group cpuinfo_attr_group = {
> + .attrs = cpuinfo_attrs,
> + .name = "info"
> +};
> +
> +static int cpuinfo_add_dev(unsigned int cpu)
> +{
> + struct device *dev = get_cpu_device(cpu);
> +
> + return sysfs_create_group(&dev->kobj, &cpuinfo_attr_group);
Why are a set of attributes being added _after_ the device is created?
We have fixed up a lot of the "default attribute" logic since 2017,
perhaps you should be using that instead?
> +}
> +
> +static int cpuinfo_remove_dev(unsigned int cpu)
> +{
> + struct device *dev = get_cpu_device(cpu);
> +
> + sysfs_remove_group(&dev->kobj, &cpuinfo_attr_group);
Same here, I don't think this is needed.
> + return 0;
> +}
> +
> +static int cpuinfo_sysfs_init(void)
> +{
> + return cpuhp_setup_state(CPUHP_CPUINFO_PREPARE,
> + "base/cpuinfo:prepare",
> + cpuinfo_add_dev,
> + cpuinfo_remove_dev);
> +}
> +
> +device_initcall(cpuinfo_sysfs_init);
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index e51ee772b9f5..2c4c59304bdb 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -78,6 +78,7 @@ enum cpuhp_state {
> CPUHP_SH_SH3X_PREPARE,
> CPUHP_NET_FLOW_PREPARE,
> CPUHP_TOPOLOGY_PREPARE,
> + CPUHP_CPUINFO_PREPARE,
> CPUHP_NET_IUCV_PREPARE,
> CPUHP_ARM_BL_PREPARE,
> CPUHP_TRACE_RB_PREPARE,
> diff --git a/include/linux/cpuinfo.h b/include/linux/cpuinfo.h
> new file mode 100644
> index 000000000000..112ff76d64d5
> --- /dev/null
> +++ b/include/linux/cpuinfo.h
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright (C) 2017 SUSE Linux GmbH
> + * Written by: Felix Schnizlein <fschnizlein@suse.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
SPDX and boilerplate.
> + */
> +#ifndef _LINUX_CPUINFO_H
> +#define _LINUX_CPUINFO_H
> +
> +#ifdef CONFIG_HAVE_CPUINFO_SYSFS
> +extern struct attribute *cpuinfo_attrs[];
No need for thie #ifdef really, right?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-06 16:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 16:24 [PATCH v5 0/3] sysfs: add sysfs based cpuinfo Thomas Renninger
2019-12-06 16:24 ` [PATCH 1/3] cpuinfo: add sysfs based arch independent cpuinfo framework Thomas Renninger
2019-12-06 16:33 ` Greg KH [this message]
2019-12-06 16:56 ` Randy Dunlap
2019-12-06 16:24 ` [PATCH 2/3] x86 cpuinfo: implement sysfs nodes for x86 Thomas Renninger
2019-12-06 16:36 ` Greg KH
2019-12-10 20:48 ` Thomas Gleixner
2019-12-10 20:53 ` Greg KH
2019-12-11 10:42 ` Thomas Renninger
2019-12-11 13:56 ` Greg KH
2019-12-11 14:12 ` Thomas Renninger
2019-12-11 14:26 ` Greg KH
2019-12-11 14:52 ` Thomas Renninger
2019-12-11 14:57 ` Greg KH
2019-12-06 16:24 ` [PATCH 3/3] arm64 cpuinfo: implement sysfs nodes for arm64 Thomas Renninger
2019-12-06 16:37 ` Greg KH
2019-12-09 10:31 ` Will Deacon
2019-12-09 11:28 ` Thomas Renninger
2019-12-09 17:38 ` Will Deacon
2019-12-10 13:33 ` Thomas Renninger
2019-12-10 14:47 ` Greg KH
2019-12-10 16:24 ` Thomas Renninger
2019-12-06 16:58 ` [PATCH v5 0/3] sysfs: add sysfs based cpuinfo Mark Rutland
2019-12-06 17:29 ` Thomas Renninger
2019-12-06 18:16 ` Mark Rutland
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=20191206163358.GB86904@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=fschnitzlein@suse.de \
--cc=fschnizlein@suse.com \
--cc=fschnizlein@suse.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=trenn@suse.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.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).