From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [char-misc-next V2] mei: add device kind to sysfs
Date: Tue, 28 Jul 2020 20:52:19 +0200 [thread overview]
Message-ID: <20200728185219.GA332869@kroah.com> (raw)
In-Reply-To: <20200728182836.3112138-1-tomas.winkler@intel.com>
On Tue, Jul 28, 2020 at 09:28:36PM +0300, Tomas Winkler wrote:
> +/**
> + * kind_show - display device kind
> + *
> + * @device: device pointer
> + * @attr: attribute pointer
> + * @buf: char out buffer
> + *
> + * Return: number of the bytes printed into buf or error
No need for kernel doc for static sysfs attributes, but ok...
> + */
> +static ssize_t kind_show(struct device *device,
> + struct device_attribute *attr, char *buf)
> +{
> + struct mei_device *dev = dev_get_drvdata(device);
> + ssize_t ret = 0;
No need to initialize this.
> +
> + mutex_lock(&dev->device_lock);
> + if (dev->kind)
> + ret = sprintf(buf, "%s\n", dev->kind);
> + else
> + ret = sprintf(buf, "%s\n", "mei");
> + mutex_unlock(&dev->device_lock);
Why do you need a lock? kind can not change, so what are you trying to
protect from?
thanks,
greg k-h
next prev parent reply other threads:[~2020-07-28 18:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 18:28 [char-misc-next V2] mei: add device kind to sysfs Tomas Winkler
2020-07-28 18:52 ` Greg Kroah-Hartman [this message]
2020-07-28 19:16 ` Winkler, Tomas
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=20200728185219.GA332869@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alexander.usyskin@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tomas.winkler@intel.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