Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp568917ybg; Tue, 28 Jul 2020 13:03:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDzGU8VI5hBUae29UW/srfrcNiEETwiasOc6V+/VHD1K4bvGbvhPd0FdcWHjBwkmJJ4Lzu X-Received: by 2002:a50:d1d8:: with SMTP id i24mr3850515edg.341.1595966595692; Tue, 28 Jul 2020 13:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595966595; cv=none; d=google.com; s=arc-20160816; b=uvG/JDS2VxOI0/Y+4tNI6bhcG3JGZsPZSkAaREu+TgUtPCk8QWql8arL8jJUXaaX9g DtRQPvRDD+bB2vVs3CeBLx5w9B2xo+cPlIWTfolqIJjhrmMr2ZksiLSgCHBQEu+5ulB6 ef0K1wB6XJNod/dxXkUrl7rYdZ5WdV8bxVfl+H7kGivXFlSxM14OrrsEhPLPQ7jhwjls qFcrZYZo7Awn19feVqD0PIgnUgFmPR9rtAPyI2iGnO1NLY6mK5j56s2MoEAXSKqONJTy mzAcgW6pQDCYW2A8D4qsQlu6vxcZGaY7nybb3Va11PaufrOLczmPJ+UEqpbhLSwYPQ+J gVag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-version:dlp-reaction:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=aW31heCrU5huUcmXG+wmM/KK8MlsqLDtF6g5nP3wMs0=; b=x5gyd/p9y+fJvgFhft1iSHSuBa58DDg+V/U6EUf1trDOaY81nNWmojlY2H+jLHXbMI eT0fVg/DelSIfWxkX3SvB7hyZ59sOKX1gzpOYAZZWV9YvICgcpMik+QPnkRt3RkEeoz6 evFB7wZblLS6mrFyUBMgH2PZess1nXYN7eGXA/6ZCFRk2MPMFJFzmjE29pJGBWvlHCkG gEEgTZPVtKmD5ph1S22nBc+yfuR6BNmxg/PzxHqigjWpAB46bpJo0XFmX3Wtd3q2wH3K cJxpNu3sqKMY8Odi5kFo+bhnGvTXy0vaS3CgLxq1eDE0Z+jbPIaeOj7f0Kg/6awgBH0L b8wg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si1472197ede.370.2020.07.28.13.02.54; Tue, 28 Jul 2020 13:03:15 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732650AbgG1TQ7 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Jul 2020 15:16:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:37804 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729133AbgG1TQ6 (ORCPT ); Tue, 28 Jul 2020 15:16:58 -0400 IronPort-SDR: oYMgtKw7WgQxnshU1GNf4kwnMLpNCn0XkXiM6d43LFwgbHwPMIub4xSxvcS0VLgePv2QCz8iIa VW3NFTBXQ+/A== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="169415910" X-IronPort-AV: E=Sophos;i="5.75,407,1589266800"; d="scan'208";a="169415910" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 12:16:58 -0700 IronPort-SDR: GDgLdRPeToXtmqek9PW4+XwtLwt371zb5zT43jdHLEP6G6Lw3Ux25ZWb+bY/66WxbggDbwWWmT JfdQ1P5urrlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,407,1589266800"; d="scan'208";a="490008716" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 28 Jul 2020 12:16:58 -0700 Received: from lcsmsx601.ger.corp.intel.com (10.109.210.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jul 2020 12:16:58 -0700 Received: from hasmsx602.ger.corp.intel.com (10.184.107.142) by LCSMSX601.ger.corp.intel.com (10.109.210.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 28 Jul 2020 22:16:55 +0300 Received: from hasmsx602.ger.corp.intel.com ([10.184.107.142]) by HASMSX602.ger.corp.intel.com ([10.184.107.142]) with mapi id 15.01.1713.004; Tue, 28 Jul 2020 22:16:55 +0300 From: "Winkler, Tomas" To: Greg Kroah-Hartman CC: "Usyskin, Alexander" , "linux-kernel@vger.kernel.org" Subject: RE: [char-misc-next V2] mei: add device kind to sysfs Thread-Topic: [char-misc-next V2] mei: add device kind to sysfs Thread-Index: AQHWZQzsP7MTlAgR70GuvAbRthg4rqkdJAuAgAA4N3A= Date: Tue, 28 Jul 2020 19:16:55 +0000 Message-ID: <8a88b1db0b9447ebaa37636a68e3b018@intel.com> References: <20200728182836.3112138-1-tomas.winkler@intel.com> <20200728185219.GA332869@kroah.com> In-Reply-To: <20200728185219.GA332869@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-originating-ip: [10.184.70.1] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 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. 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.