From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20F4FC433EF for ; Tue, 14 Sep 2021 09:23:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E48CC60F25 for ; Tue, 14 Sep 2021 09:23:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E48CC60F25 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tbRTDU5oO7RL7cpMPJ/FOXDN8DKmx0nsiDx81BEbj4A=; b=JzvbFnZ3daR+x4 qCXw+TsiY9NT6OwQR3jcAUWNyyMAGSCWL7wXPp/lvlnU9DsQyx71ZVHUAJed0yrgfCv8H/VaxkPAn hrCACnkkTRHtd7CkgO4uHHiHL5ForbzjeoNadtK+TzrF6l92sZqPQh6ReEq+3J3w7/LihYHJ3YsCv K6A9ICPKSHEcaYZa4SLQAxM5Apq47JoOfZWxVa+Z+1tp1ld1tWf/WeHQDrnqItsM0Wsk3sg6cVn2Y AT1C5q+yI0AFkJF7mxzXYF7yak66yF8/Z6XPDgvSldgYGlw8oDK1i7UOUJEiiWaZCwTDDZ4GiSx9C osMHjV54ZN7oI/TxijGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ4dN-004z6G-Fw; Tue, 14 Sep 2021 09:21:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ4cy-004yxM-4M for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 09:21:21 +0000 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-Disposition: inline In-Reply-To: <20210913083955.27146-4-ronak.jain@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_022120_244193_2170F025 X-CRM114-Status: GOOD ( 20.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 228DAC433F5 for ; Tue, 14 Sep 2021 09:21:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0671861108 for ; Tue, 14 Sep 2021 09:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbhINJWi (ORCPT ); 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