[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728185219.GA332869@kroah.com>
Date: Tue, 28 Jul 2020 20:52:19 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Tomas Winkler <tomas.winkler@...el.com>
Cc: Alexander Usyskin <alexander.usyskin@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [char-misc-next V2] mei: add device kind to sysfs
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
Powered by blists - more mailing lists