All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Winkler, Tomas" <tomas.winkler@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Usyskin, Alexander" <alexander.usyskin@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [char-misc-next V2] mei: add device kind to sysfs
Date: Tue, 28 Jul 2020 19:16:55 +0000	[thread overview]
Message-ID: <8a88b1db0b9447ebaa37636a68e3b018@intel.com> (raw)
In-Reply-To: <20200728185219.GA332869@kroah.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.
Right, a leftover from an earlier version. 
> 
> > +
> > +	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?
There might be firmware initiated reset but in this particular case you are right,  the lock is not needed.

Will resend. 


      reply	other threads:[~2020-07-28 19:17 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
2020-07-28 19:16   ` Winkler, Tomas [this message]

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=8a88b1db0b9447ebaa37636a68e3b018@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.