Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2021592pxb; Thu, 11 Feb 2021 02:07:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcsMSBgJ5GTsnM8llgNYYDgBAR57t7zzj1U4rgv11SUTPCSp20pHT6mrtNVT4HULO8pHTR X-Received: by 2002:aa7:cd8c:: with SMTP id x12mr7796566edv.355.1613038067903; Thu, 11 Feb 2021 02:07:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613038067; cv=none; d=google.com; s=arc-20160816; b=OO13J+o3GkYHvNIOn5TX2lO/7H/5r0jBJvPAvhY9omej20j1778mreAdGYv+HAJyYZ 79IVdHsd49wxNk269xqFM9DzMBdXkKfVzBc/FZSFVwPmdiiJo2BnJkCLwiI9OiknbEZ1 OvbWj5hMtFbvze15GXG9AATqfR/GolDIy/lExQUMfh5PGntVFnPX2cez5pIR4jVtF1pD fD+Pqz2pAs/1WqL0et0qb08Gh/Wxi9c4Zq++uaCK08JiyuKvpsFOB4b9s95gUZr7lxMO fCWBCiGlxVUaNy5GQUWJ6m06AapYMFYFteIl4Zk4qmTe2JM66gEtFqFcv9c+UkJ5l0DK /Fag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I6N4+pRWblonpBOQNJGf2JXSsnbrkvxQn91sLwHGDik=; b=AJJ2p0rhpYn4YSXh882Wtop+HKRth3BN8+YgU5o7yYJNIcUM7DZ1epayr/U+SQXT7j +7GyEI6eXBvNjXLupsiP6nKIOt23404OPE2eTr9j3DRvithjZJhBOfQyhSw4Djm2LstX mrt84tKLptFZQKTUhl19UWsrYJ8DEh5lPaTQlgArZs2dXJQt01b/IPgd5ta/ropQnUH9 5310Cl2gytGcB9z3c/+ZLvyJJRfNfX3KADoTJ/qmIPkqkXvSMPEpMkmqWRzjOc1uKy0S crrx4ysSHlCzWvdz62hxa4APC2twv+Wqpp25l7J2UN8kSa6Pa+TZzI3SIpLDpNGMa4NT WlNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AWWZoRuP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz11si3341929edb.175.2021.02.11.02.07.24; Thu, 11 Feb 2021 02:07:47 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=AWWZoRuP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbhBKKD6 (ORCPT + 99 others); Thu, 11 Feb 2021 05:03:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:48114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhBKKAL (ORCPT ); Thu, 11 Feb 2021 05:00:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 28C9364E92; Thu, 11 Feb 2021 09:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613037569; bh=Zj8EM5Xx2JdkHBzV0ZcjFswDPawBzyPCgGJvYO+nIu8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AWWZoRuP1RODcWAYJNKCM5+kpL3fmGLyr9DvCV/ZQ2eEJ9z2skeQfz363Q4jD0lYz MpLPk2vG4KdlTlTSuyCCd5cDnCUEfeI0AbHRukiZXBQtUL1zLIkwXtcf/TXrA7psuM wR5GQzW5oQqTSOsmK3tCpvjatd85poXQ9XDi/UOU= Date: Thu, 11 Feb 2021 10:59:26 +0100 From: Greg Kroah-Hartman To: Gustavo Pimentel Cc: "linux-doc@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Jonathan Corbet , Bjorn Helgaas Subject: Re: [PATCH v5 1/6] misc: Add Synopsys DesignWare xData IP driver Message-ID: References: <02835da8fc8c9293fecbe666a8db3fb79276fdde.1613034397.git.gustavo.pimentel@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 11, 2021 at 09:50:33AM +0000, Gustavo Pimentel wrote: > On Thu, Feb 11, 2021 at 9:30:16, Greg Kroah-Hartman > wrote: > > > On Thu, Feb 11, 2021 at 10:08:38AM +0100, Gustavo Pimentel wrote: > > > +static ssize_t write_show(struct device *dev, struct device_attribute *attr, > > > + char *buf) > > > +{ > > > + struct pci_dev *pdev = to_pci_dev(dev); > > > + struct dw_xdata *dw = pci_get_drvdata(pdev); > > > + u64 rate; > > > + > > > + mutex_lock(&dw->mutex); > > > + dw_xdata_perf(dw, &rate, true); > > > + mutex_unlock(&dw->mutex); > > > + > > > + return sysfs_emit(buf, "%llu MB/s\n", rate); > > > > Do not put units in a sysfs file, that should be in the documentation, > > otherwise this forces userspace to "parse" the units which is a mess. > > Okay. > > > > > Same for the other sysfs file. > > > > And why do you need a lock for this show function? > > Maybe I understood it wrongly, please correct me in that case. The > dw_xdata_perf() is called on the write_show() and read_show(), to avoid a > possible race condition between those calls, I have added this mutex. What race? If the value changes with a write right after a read, what does it matter? What exactly are you trying to protect with this lock? thanks, greg k-h