Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp499712pxb; Tue, 14 Sep 2021 02:23:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRZgc0/4tL0FFkofgHzvsvU2+zXMlw2hgaEQdExZsN7Npnq6RWZm0TKoMyFvVY9Se5dOG/ X-Received: by 2002:a05:6638:2405:: with SMTP id z5mr2026540jat.124.1631611401563; Tue, 14 Sep 2021 02:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631611401; cv=none; d=google.com; s=arc-20160816; b=t/GAz2KBgCnFM/Otg9VmK7H4b54fyj22Fx2fwN0hIBA/tS9+cvTuI6KUjIY/HxKXOK Aj46X4V13kWQ7jC1IXdVgVwHCkJpj6g5ZW0NpF85RdxpIW1On6h85EcorM5SqU1Q40IA q5XzejbMJHcbk4XpRXmjQPjfpoYInYa4wMh5mBw1L3DRXObHpwMlD65xiHk5H98l5TAV 3b7aBQCi/G0Nfuq7vENJsSaliL2cgabFstSc55Z+5owsgIhXLYG6F1XS02hN1NZicGtM NDTFCS4kLZwOjltCYg/sUrstwRjDwLRLO+wPgvLqEgszU4P5jXD5b9KPrrSyfXaDMBnE 6KpA== 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=P5C8WmZT0pO9MHPJ/9PsegK4PCE6EgyjDfOdu718ExU=; b=JSU01AFVGz1n2MoGioomlvNSq1xzbtjqyAsPu9Zh0ZliqaRhbYNrDUaiEAZTLTubWN bBUesTP1j9V8ks9xL+3/KH8QlykjcAWXxjKlfzwZw2BYWpqGXTMfM93dL4iizTT+da3r LQsJz3LNCDutCH3Q6HrA0QM09LJ/5MvK3vqH1JCkk7OnQtHaYMsKr7jqMbEJ7xnhLrg/ afoWPPUaCcPXAi0ZzAdvZq7dxss6dq6zZMcpbsJZN1GzB1JDRQBEKX26p3eSQw0inPWr /Efz/J5GbKpSqmASBLetXsxrVAsSdLKWTZVquEkDBATDlXnXZchrOgAx1yggiBbZ+Mzj IdYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DEniEjEb; 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 c32si9455825jaa.44.2021.09.14.02.23.09; Tue, 14 Sep 2021 02:23:21 -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=@linuxfoundation.org header.s=korg header.b=DEniEjEb; 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 S229917AbhINJWi (ORCPT + 99 others); Tue, 14 Sep 2021 05:22:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:52420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbhINJWh (ORCPT ); Tue, 14 Sep 2021 05:22:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C8FF60ED7; Tue, 14 Sep 2021 09:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631611279; bh=/o3FK+9c3o+eV9htHp9C/KhGX0C5wFlWSRnqjC+pM4I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DEniEjEba0EHFsv9Zaqu9GoOSQKkonmJRfmr2Hvl3F+MZcuDakX3R7HFNWbi428Kk sSyRojwn/yF131n7YARTqOd/KdmpayBzzH9arAqXr24hIWlIAZy93e5ehPwCpobTbd KYBhT6g7yCoVgzVkFArtKJDbpJe9ljSqEnN/Z/ZQ= Date: Tue, 14 Sep 2021 11:21:17 +0200 From: Greg KH To: Ronak Jain Cc: michal.simek@xilinx.com, linux-kernel@vger.kernel.org, rajan.vaja@xilinx.com, corbet@lwn.net, linux-arm-kernel@lists.infradead.org, arnd@arndb.de, lakshmi.sai.krishna.potthuri@xilinx.com Subject: Re: [PATCH v2 3/3] firmware: xilinx: Add sysfs support for feature config Message-ID: References: <20210913083955.27146-1-ronak.jain@xilinx.com> <20210913083955.27146-4-ronak.jain@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210913083955.27146-4-ronak.jain@xilinx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13, 2021 at 01:39:55AM -0700, Ronak Jain wrote: > Add support for sysfs interface for runtime features configuration. > The user can configure the features at runtime. First the user need > to select the config id of the supported features and then the user > can configure the parameters of the feature based on the config id. > So far the support is added for the over temperature and external > watchdog features. > > Signed-off-by: Ronak Jain > --- > Changes in v2: > - Update commit message > --- > drivers/firmware/xilinx/zynqmp.c | 71 ++++++++++++++++++++++++++++++++ > 1 file changed, 71 insertions(+) > > diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c > index 875d13bc1a57..a1434dd368f2 100644 > --- a/drivers/firmware/xilinx/zynqmp.c > +++ b/drivers/firmware/xilinx/zynqmp.c > @@ -1361,6 +1361,75 @@ static DEVICE_ATTR_RW(pggs1); > static DEVICE_ATTR_RW(pggs2); > static DEVICE_ATTR_RW(pggs3); > > +static atomic_t feature_conf_id; Why does this have to be an atomic? And shouldn't this be per-device, not global to all devices in the system? > + > +static ssize_t feature_config_id_show(struct device *device, > + struct device_attribute *attr, > + char *buf) > +{ > + return sysfs_emit(buf, "%d\n", atomic_read(&feature_conf_id)); > +} > + > +static ssize_t feature_config_id_store(struct device *device, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + u32 config_id; > + int ret; > + > + if (!buf) > + return -EINVAL; How can there ever be a NULL buffer? No need to check for impossible things. thanks, greg k-h