Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp185453pxb; Thu, 21 Apr 2022 21:01:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmFLq/a9HJbOiP0ZhpKPz9AFAsqRP2GD+f3o1u7hUjmAGH8EFbWTiAO9HRHdl5RdKH6PIq X-Received: by 2002:a17:906:846b:b0:6ef:af54:f2cc with SMTP id hx11-20020a170906846b00b006efaf54f2ccmr2286036ejc.662.1650600059752; Thu, 21 Apr 2022 21:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650600059; cv=none; d=google.com; s=arc-20160816; b=mgU+3r+8SlLhBKMUwrbH9eVZvOSh2heV7It8JN4G+1fHTcR3hglCN/A2lskMzvyCLl 5eYWgN3jBKdctSqlH+cIWAvt2sSMGuH709zbsRqnuPhrGkjfOawtV7wNooWMWkfkQh+f eGBpvf9BZDRKwGriRoVlGLQpJ/JyK8GRKwKMUWVhsZmc48sDLzPQ1tJVCdg/WET+WSPS jr7wOpOK9m/mWX5IcDZoIIh3d3B7tDPVsNfgbZXCHPzTvVj10QxwKTFeb+6n/xl3DQpk zZwKcyJP9mO+RZXfMSPvGHHnPKs4zj+tV+iPIUvkoJF7Kk3RArE3bteY4dHAGqShyecN kVhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:reply-to:cc :from:to:dkim-signature:date; bh=IMTEaCLkX65EaOGDF8JEGvzDdRQQF9214T4nBiguiKA=; b=DEvlUIU3PPtv6L0LrtDyuI32L7eoedOwBLIZUdehpY+2OFuSpYtHD+wwhFmedMtqaW uj0iq8IMTSXZIsrscCcqGnw+blvt36UWWw7ySf/5v79EH/wthWTa8Zt9xi9+Kep6UgR2 1/hDyGEEQ6b4/RTQk8Kmt6TTicyiMMg5DfUjVZrsZC8lu432+Ym6POEgeYRQnme64UmX qTeeb8QvmR+hCGj27bAgLRcaOLCbiIqG/f0L2iO8Z27t4nXo4RHIFDmfXRQxUpmTF4dr 0nzcmgWfgi5RTFLy2oME62B5tnJHbWyxVdZIY/RbG6DzHrwqje+6cByX8oTva4fDGd0R GkPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wujek.eu header.s=protonmail2 header.b=ePdmDlES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a50d705000000b00423d6efeafasi4884552edi.173.2022.04.21.21.00.35; Thu, 21 Apr 2022 21:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wujek.eu header.s=protonmail2 header.b=ePdmDlES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382551AbiDTVkS (ORCPT + 99 others); Wed, 20 Apr 2022 17:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356105AbiDTVkN (ORCPT ); Wed, 20 Apr 2022 17:40:13 -0400 Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B06F536140 for ; Wed, 20 Apr 2022 14:37:24 -0700 (PDT) Date: Wed, 20 Apr 2022 21:37:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wujek.eu; s=protonmail2; t=1650490642; bh=IMTEaCLkX65EaOGDF8JEGvzDdRQQF9214T4nBiguiKA=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=ePdmDlESgtZYOn3SVJgnY+HTI5tLpqwuJC6rjIBU3Evzfr+CBpKHv1LlcSqwUL336 z/2C0R71UmbKSB/fXKC0AzuC+R5sjYLu6Q6/XDx1L+VpehWoce5g8nX3vJ5ecMYxEl zBo2zh7NSFzxGQDAxWQmrb0mmNsNuSDxk2MwRgPbqja9iq7qcX5OSaBK4+otix7S8d GqDDmNv/NsPvPANg+XZlZvv8opgCdgJBbgfS1S3lfLHg1pzcHg2SYf1nOIEcs6LY5a AOpeoiAbtxPScvzjAiERQ7j0i0Cm9s5QLVMxMLGCZN67aSwLPxz6nE4lBt3ll0hNQf Hd2rRvlC+iUGQ== To: Guenter Roeck From: wujek dev Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: wujek dev Subject: Re: [PATCH 2/2] hwmon: (pmbus) add MFR_* registers to debugfs Message-ID: In-Reply-To: <1b12cb3a-3d87-8254-b229-dcf83ad0bc0a@roeck-us.net> References: <20220419215326.309991-1-dev_public@wujek.eu> <20220420122128.411757-1-dev_public@wujek.eu> <6f697b2c-58aa-6ca4-966b-147bcc184dad@roeck-us.net> <1b12cb3a-3d87-8254-b229-dcf83ad0bc0a@roeck-us.net> Feedback-ID: 23425257:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ------- Original Message ------- On Wednesday, April 20th, 2022 at 18:06, Guenter Roeck = wrote: > > > On 4/20/22 08:51, wujek dev wrote: > > > ------- Original Message ------- > > On Wednesday, April 20th, 2022 at 16:15, Guenter Roeck linux@roeck-us.n= et wrote: > > > > > On 4/20/22 06:58, wujek dev wrote: > > > > > > > ------- Original Message ------- > > > > On Wednesday, April 20th, 2022 at 15:53, Guenter Roeck linux@roeck-= us.net wrote: > > > > > > > > > On 4/20/22 05:22, Adam Wujek wrote: > > > > > > > > > > > Add registers to debugfs: > > > > > > PMBUS_MFR_ID > > > > > > PMBUS_MFR_MODEL > > > > > > PMBUS_MFR_REVISION > > > > > > PMBUS_MFR_LOCATION > > > > > > PMBUS_MFR_DATE > > > > > > PMBUS_MFR_SERIAL > > > > > > > > > > > > Signed-off-by: Adam Wujek dev_public@wujek.eu > > > > > > > > > > Where is patch 1/2, and why did you resend this patch ? > > > > > > > > There should be no "1/2" since this and the second patch are unrela= ted. > > > > I resend it because I rebased it on master. > > > > > > Please provide change logs and version your patches in the future. > > > ok, thank you for your patience. > > > > > > > Adam > > > > > > > > > Guenter > > > > > > > > > > > --- > > > > > > drivers/hwmon/pmbus/pmbus_core.c | 84 +++++++++++++++++++++++++= +++++++ > > > > > > 1 file changed, 84 insertions(+) > > > > > > > > > > > > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/p= mbus/pmbus_core.c > > > > > > index 0af7a3d74f47..1dc186780ccf 100644 > > > > > > --- a/drivers/hwmon/pmbus/pmbus_core.c > > > > > > +++ b/drivers/hwmon/pmbus/pmbus_core.c > > > > > > @@ -2625,6 +2625,30 @@ static int pmbus_debugfs_get_status(void= *data, u64 *val) > > > > > > DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugf= s_get_status, > > > > > > NULL, "0x%04llx\n"); > > > > > > > > > > > > +static ssize_t pmbus_debugfs_mfr_read(struct file *file, char = __user *buf, > > > > > > + size_t count, loff_t *ppos) > > > > > > +{ > > > > > > + int rc; > > > > > > + struct pmbus_debugfs_entry *entry =3D file->private_data; > > > > > > + char data[I2C_SMBUS_BLOCK_MAX + 2] =3D { 0 }; > > > > > > + > > > > > > + rc =3D i2c_smbus_read_block_data(entry->client, entry->reg, d= ata); > > > > > > + if (rc < 0) > > > > > > + return rc; > > > > > > + > > > > > > + data[rc] =3D '\n'; > > > > > > + rc +=3D 2; > > > > > > Why +2 ? > > > > Copied from another driver. > > +1 due to '\n' > > +1 due to NULL character (smbus block transfer does not include it in t= he length) > > Explanation included in v3 patch. > > > "copied from another driver" is not really a good argument. > That other driver might just be buggy. yes, you're right. There is a bug in that driver. > > What do you see in userspace when you read the data ? A string that ends = with > "\n\0" ? If so, does the "\0" at the end add any value ? I confirm I see "\n\0". I will fix it right now. Thank you for pointing it = out. Adam > > Guenter