Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp568283ybg; Tue, 28 Jul 2020 13:02:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxe/xN8A+W6hUq8M4D2FMztfO3nZPp10tKEoubj0nrBVC/KhQRKMgf4pvbGfhyCSXIs6s4 X-Received: by 2002:a17:906:c0d9:: with SMTP id bn25mr26526328ejb.176.1595966552796; Tue, 28 Jul 2020 13:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595966552; cv=none; d=google.com; s=arc-20160816; b=CoTO+UXqbEC4wGCVqeQ77JSzr58+lVznYVsvcsJFt2VgRr75CCgEPyNpu+jpdG/JxC 4CCmD621tZIodNEXtS/X6Xov7SfMYatL1QLLHyOL6wV7pqiKuAGnCrqyWm4a6njrNLTO 3fQTAfo2yz4eD++wPVVHsJ9kMv5BLj3Fc3GgIO9NYZILTNMXLsXU57EGIWuZtKvdQUSJ 5pThxtMjIJYHNGi/EScGjq1sNdzHQZqCF6v+UM6EaA5jPLspoE/KW6q/3S4+7rcMtlOm L8yrGCYtUnpoM9SO7084aWflM0Z8xVdCoJe3U5DaSssBVWClactFLvh6g4zf3+IzoiMz /e9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6uejNMN/yaH7lIiwG/sEI0BK7WedAzy0TyhXVE+JW/E=; b=rS6g0UwZpBNIIrlN88qspMuDhCJ6TiQUVDZUaiQoXs42r/9p74/l5najgp8qnvUikS I8+wJp8AMgdVIVOogBsrm41Oosu+7nqeuLETKomkqerld/fUmPPPUlYkUsuy3qRbPfgP +lEWSiMOIbBfDdPpRJ7vxsaRKtzezut1OkMK4jn25Tiy08xLdBsIcc43kgUTFnlyG4Th 7cFxyijQqEEVgV+U80kG+hcF9shzGBlWipdiqTRmZQOwLYmL/16yO8LXn5uT7PdTV1PI B+qcQW1Q62Lp4qglZARWREfYt7mdLQ8TY3T97tmaAhjvMSsfAlMmMVbgpyW/M4CWfINQ t6KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EIoxyRfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si7558250ejc.314.2020.07.28.13.02.10; Tue, 28 Jul 2020 13:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EIoxyRfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732526AbgG1Sw1 (ORCPT + 99 others); Tue, 28 Jul 2020 14:52:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:59424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728782AbgG1Sw1 (ORCPT ); Tue, 28 Jul 2020 14:52:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BD27207F5; Tue, 28 Jul 2020 18:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595962346; bh=rsFGSYZoh2bZszC7RRw3GX0SpaEAw/9n5VERca7iaR0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EIoxyRfq2KfJp3DBWrKjo1N9oI8C6DYlxtytnW1DDEOWwveOGMmBhJJ3uVwlw9IMF JNbWB6gzqycGRaLOw0CSjhWmSavONkchpZ7e/3XQcfhD3BfOYxnPln11kSqlZV364m rjNJ6hgowqgMwxp4epeHla5Srxj9/MPQyo/VqqRU= Date: Tue, 28 Jul 2020 20:52:19 +0200 From: Greg Kroah-Hartman To: Tomas Winkler Cc: Alexander Usyskin , linux-kernel@vger.kernel.org Subject: Re: [char-misc-next V2] mei: add device kind to sysfs Message-ID: <20200728185219.GA332869@kroah.com> References: <20200728182836.3112138-1-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200728182836.3112138-1-tomas.winkler@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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