Received: by 10.223.176.46 with SMTP id f43csp1368303wra; Wed, 24 Jan 2018 15:31:28 -0800 (PST) X-Google-Smtp-Source: AH8x227oMieDLroTgrSaGr40MXVWSXxr9qOlYgruFo+kT9+8DK5js657Okn+HCUaRKDCk357bi5h X-Received: by 2002:a17:902:71c6:: with SMTP id t6-v6mr9927480plm.318.1516836688341; Wed, 24 Jan 2018 15:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516836688; cv=none; d=google.com; s=arc-20160816; b=lY0YR0oMkrZMS0wosnr1DM1UFGOB3p8uYs04nM5WYjYoBiQeZYBpPybv3Q7E8IIUai Db6bjN61irabQsEhXxZoS+z2dc8WmCILbEulJtrrnx3hKO4GdKAsPaRJ+z9UghnXuNUI 1lphdxFo6tjA3uHk2CHe0DIft1wXcK/GMRerpiDZkGTefZtaWDAKGorEKNFIT6YHIU6+ YIjTfhfZh9n01/qI3dLVpRpAL2rSS/htj7g93akkKkf4hytw4Vr2VSAn3yk/V+l9e+il 4pSe71N2yQtS2zbVfOz3GEkHV9zOZ3/rvGmP2KwK/eAi6ueNCOkjLZGPGtWl+PI5OKCY C7iQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=DRJQCERkl8WPWSDMxSR/cChBb86SmTu9VcaVziWLrjQ=; b=RDBqPPamvJTY8b70iX0iBp55D+rolJC7tQvm1T7BorCkPQqK6kDNz6wnE86kkS9U4T GFv67B2CanzvWOkPJOmNh2yjISg4Ddyc/N1HlGHkF9rVYe+2TBP24piZcXCRIyaOG7z8 uyW1oEVUaZ55+BFlJuEBj0Rd50VyQp2oSMyorq6U/wvh7tUQmIQ9g//3CysTOFi9ASo7 TaK6UP8IOpnZmRmoLzqL+/1qEDlX2Q6EFGUMBtHWN5m7nDkdG3tKUbcEU3FJUSLJMM6P QjJHsMzzusRoOlNVOT5BYADQTgvYEBQ5ePdLkXFhs7m3mW157bCcF/p/doFgUdyIwDRu +4ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=XA8WOOm9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si892244pla.643.2018.01.24.15.31.13; Wed, 24 Jan 2018 15:31:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=XA8WOOm9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932955AbeAXXau (ORCPT + 99 others); Wed, 24 Jan 2018 18:30:50 -0500 Received: from mail-by2nam01on0070.outbound.protection.outlook.com ([104.47.34.70]:51905 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932072AbeAXXas (ORCPT ); Wed, 24 Jan 2018 18:30:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DRJQCERkl8WPWSDMxSR/cChBb86SmTu9VcaVziWLrjQ=; b=XA8WOOm94H+ZRtxprEqxRTljzwMaUrOzmYgRTqmaybRkwB2GctZ7LMAWuGEGWoZbI2Qf9XC7X91xL3ULa2p3Lrs2+8K6Np5SzerC1SSS/pf9+19xzvQQJ/0XeBHFntqZbiGvb3KQqJSDgTOoc3H+iWpAJa3pajI5u/u152tJc4Q= Received: from DM2PR0201MB0767.namprd02.prod.outlook.com (10.160.95.13) by DM2PR0201MB0992.namprd02.prod.outlook.com (10.160.219.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Wed, 24 Jan 2018 23:30:44 +0000 Received: from DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1]) by DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1%14]) with mapi id 15.20.0428.024; Wed, 24 Jan 2018 23:30:43 +0000 From: Jolly Shah To: Greg KH CC: "ard.biesheuvel@linaro.org" , "mingo@kernel.org" , "matt@codeblueprint.co.uk" , "sudeep.holla@arm.com" , "hkallweit1@gmail.com" , "keescook@chromium.org" , "dmitry.torokhov@gmail.com" , "michal.simek@xilinx.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , Rajan Vaja Subject: RE: [PATCH v2 3/4] drivers: firmware: xilinx: Add sysfs interface Thread-Topic: [PATCH v2 3/4] drivers: firmware: xilinx: Add sysfs interface Thread-Index: AQHTj9C1X0Q17E9ZmUefI4pznEWOfKOBKzAAgAKKrIA= Date: Wed, 24 Jan 2018 23:30:43 +0000 Message-ID: References: <1516220434-22204-1-git-send-email-jollys@xilinx.com> <1516220434-22204-4-git-send-email-jollys@xilinx.com> <20180123083732.GA21463@kroah.com> In-Reply-To: <20180123083732.GA21463@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=JOLLYS@xilinx.com; x-originating-ip: [149.199.62.254] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM2PR0201MB0992;7:3nnPbaU97XX+hEIjysmjcyvRyYzn1HKxS2n6JDpGyomIDx3rxWhhEwhTbfKvApJjU7JDWATCDmKddcq/qTwgIScP/oI4wBuhHZtEIlWzwreOqZsP9PLzYQQrcar+S1eJ1pk4CG5eijzgyYaR1MfeiOGa4Ln/ejzubTk/QdUIcaVttPFxrV/paHNu9aeFZPmiE4fVgO9iZrN2nCyGSeGhDXsa9eq7+jU056PFJ4w8vADVWk8OgwmKStBIRSPDzKaV x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(39860400002)(366004)(396003)(39380400002)(346002)(376002)(189003)(199004)(13464003)(8936002)(229853002)(33656002)(81166006)(3846002)(26005)(6116002)(8676002)(81156014)(6436002)(9686003)(55016002)(3660700001)(5250100002)(316002)(68736007)(76176011)(54906003)(3280700002)(53936002)(7696005)(478600001)(66066001)(106356001)(6246003)(25786009)(86362001)(39060400002)(72206003)(7416002)(107886003)(2900100001)(53546011)(97736004)(59450400001)(6506007)(105586002)(2950100002)(74316002)(5660300001)(2906002)(4326008)(6916009)(99286004)(102836004)(14454004)(7736002)(305945005)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0201MB0992;H:DM2PR0201MB0767.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: 04f1673b-f837-48ca-1b47-08d563827d0d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7153060)(7193020);SRVR:DM2PR0201MB0992; x-ms-traffictypediagnostic: DM2PR0201MB0992: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(9452136761055)(85827821059158)(258649278758335)(192813158149592); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231023)(2400081)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM2PR0201MB0992;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0201MB0992; x-forefront-prvs: 056297E276 received-spf: None (protection.outlook.com: xilinx.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: R4AiXE3eVh7RXdRhWSKBtyxoVIhsX1ye9SVHO4MkBsVSkDEbQ3g7TBRbbBO8LpTG5wyy4OHCOw/KqNaiHkI/Yg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04f1673b-f837-48ca-1b47-08d563827d0d X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 23:30:43.5827 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0992 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for review Greg, > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Tuesday, January 23, 2018 12:38 AM > To: Jolly Shah > Cc: ard.biesheuvel@linaro.org; mingo@kernel.org; matt@codeblueprint.co.uk= ; > sudeep.holla@arm.com; hkallweit1@gmail.com; keescook@chromium.org; > dmitry.torokhov@gmail.com; michal.simek@xilinx.com; robh+dt@kernel.org; > mark.rutland@arm.com; linux-arm-kernel@lists.infradead.org; linux- > kernel@vger.kernel.org; devicetree@vger.kernel.org; Rajan Vaja > ; Jolly Shah > Subject: Re: [PATCH v2 3/4] drivers: firmware: xilinx: Add sysfs interfac= e >=20 > On Wed, Jan 17, 2018 at 12:20:33PM -0800, Jolly Shah wrote: > > Add Firmware-ggs sysfs interface which provides read/write interface > > to global storage registers. > > > > Signed-off-by: Jolly Shah > > Signed-off-by: Rajan Vaja > > --- > > .../ABI/stable/sysfs-driver-zynqmp-firmware | 33 +++ > > drivers/firmware/xilinx/zynqmp/Makefile | 2 +- > > drivers/firmware/xilinx/zynqmp/firmware-ggs.c | 298 > +++++++++++++++++++++ > > drivers/firmware/xilinx/zynqmp/firmware.c | 26 ++ > > include/linux/firmware/xilinx/zynqmp/firmware.h | 2 + > > 5 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 > > Documentation/ABI/stable/sysfs-driver-zynqmp-firmware > > create mode 100644 drivers/firmware/xilinx/zynqmp/firmware-ggs.c > > > > + > > +#include >=20 > That's crazy deep nesting, why? It needs to be in include/linux to be used by other drivers and as it is Xi= linx specific, we have it in subdirectory. >=20 > > + > > +static ssize_t read_register(char *buf, u32 ioctl_id, u32 reg) { > > + int ret; > > + u32 ret_payload[PAYLOAD_ARG_CNT]; > > + const struct zynqmp_eemi_ops *eemi_ops =3D get_eemi_ops(); > > + > > + if (!eemi_ops || !eemi_ops->ioctl) > > + return 0; >=20 > Not an error? Fixed in v3 patch series. >=20 > > + > > + ret =3D eemi_ops->ioctl(0, ioctl_id, reg, 0, ret_payload); > > + if (ret) > > + return ret; > > + > > + return snprintf(buf, PAGE_SIZE, "0x%x\n", ret_payload[1]); >=20 > Minor nit, you never need to use snprintf() for a sysfs file, as you "kno= w" the size > and you can't overflow it with just a single value. >=20 > Yeah, some tool-checkers hate to see a "raw" sprintf() call, but really, = ignore > them here :) Changed to sprint in v3 patch series. > > + > > + /* Read the write value */ > > + tok =3D strsep(&inbuf, " "); > > + if (!tok) { > > + ret =3D -EFAULT; > > + goto err; > > + } > > + > > + ret =3D kstrtol(tok, 16, &value); > > + if (ret) { > > + ret =3D -EFAULT; > > + goto err; > > + } >=20 > What exactly is the format for the data to be written here? You do not > document it in the ABI/ file above, and it looks to be non-trivial to und= erstand > from the code :( >=20 Updated documentation in v3 patch series. > > + > > +#define CREATE_PGGS_DEVICE(dev, N) \ > > +do { \ > > + if (device_create_file(dev, &dev_attr_pggs##N)) \ > > + dev_err(dev, "unable to create pggs%d attribute\n", > > +N); \ >=20 > Ick, no, just use an attribute group please. Handles all of this mess fo= r you > automatically, and will unwind properly if you have an error (which this = macro > does not do.) >=20 > thanks, >=20 > greg k-h Fixed in v3 patch series. Thanks, Jolly Shah