Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp461195pxb; Fri, 22 Apr 2022 04:58:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy48xlhIxckcbQOjtPlz1PMKKfHLW44K9BZYd+/HnsvF92QM1wul0LafkgGPfok9vRHyGLg X-Received: by 2002:a50:9518:0:b0:425:c3f3:5482 with SMTP id u24-20020a509518000000b00425c3f35482mr801746eda.350.1650628732439; Fri, 22 Apr 2022 04:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650628732; cv=none; d=google.com; s=arc-20160816; b=PToqkqDWquqTN9QHEn16dbgPW4R0NnB4P7q8D6sXcF6J4um53gjUNnCj9mb3A+hqoe kthPs/gqcocn4gqotAK6uag+CWrZyjyKwMRGWhULVvjE11Cg0CgjaV08+LhkBHYmnbYi Xn6pjVcDrDjPx8fZ5x/nLl0kcauwFLnZ7kNG7FKjksgU9wLSUN12XogcU2zyz5r1uHEG oW87UrprH6FUvRZkVAZL1d/B6CHX+2tUtkhdRE7hmKv74uTtD6k9Kip9F4d+UZOSYVa9 FeTW2odj3cNzGWv9fa2k5ZZaUVh3dH62Q57rbfU/MehHcMB1Yn15rMVPJg4zBJY8VbgB FDwQ== 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=W3/wkW5PX/t+tDDGms9gDWvuN5VQYe1ocPnfgFf/1e0=; b=onDBpi+S+sCj3bw1RdhAQmsk8S1p1wsDNZ2kIaBd3/YqYscfmWMTUKKTjRFY1Ob/yr XHWcOq+od49uWmcOIUZYVXb64iZMIFaDh7iUiozKcALDidtYIupgQml8Mrv8OwEmz8Sh yVUSq5zZr0hxgaWcyimNgZn4bFeo9zZ3ykQ/3HkNkoNDtGgLr/62artcTOhcWsHSqcPU u+Cc3vEma4FVOU0TgbHEViTVmY3Zl6BDi1TVLMPn7JY635wWOE+hPytSVcnuQm5fEMyk YN6DMeTCURJn1W/9IIukmCSJXBjDX3I2Yux+mIYcQqnoyFThblvlnzd1yEWnpec08mQB mWOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wujek.eu header.s=protonmail2 header.b=afmyXuz4; 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 z24-20020a17090665d800b006e895dec42asi6176804ejn.198.2022.04.22.04.58.26; Fri, 22 Apr 2022 04:58:52 -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=afmyXuz4; 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 S1379265AbiDTOB1 (ORCPT + 99 others); Wed, 20 Apr 2022 10:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358948AbiDTOB0 (ORCPT ); Wed, 20 Apr 2022 10:01:26 -0400 Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8E843497; Wed, 20 Apr 2022 06:58:39 -0700 (PDT) Date: Wed, 20 Apr 2022 13:58:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wujek.eu; s=protonmail2; t=1650463117; bh=W3/wkW5PX/t+tDDGms9gDWvuN5VQYe1ocPnfgFf/1e0=; 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=afmyXuz4MRjgmby80LD+4aLz25pH0kXFyUHUoiL/uOGim16NSZvi6BfBwKHzvhmhy mRA6xpCdOeWtaquzBpx7of4DyW35hFDhCkSOkdRykFUsGcrFm+RrNZnP+uATy7JJYq vF+d34uvt7eXhzaNwZhsO1EIYwOBMVZk/tMJHrUOMIoLETyk1qMz09Qzd2Dgdrnw7E 78B0bxVlQO/7RKRnqhzr3YDfKjrRvAtsxP2SrlDw9jzjYPX0G0u07uhoC0Q/iTkq2t Ks+30D3H0LE6hqeaNEyG8YRWCIQINe1ZiHILScoHmxmh8637+fu3ebWjK6051oN5y3 2mhqMz0M6E+DA== 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: References: <20220419215326.309991-1-dev_public@wujek.eu> <20220420122128.411757-1-dev_public@wujek.eu> 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 15:53, Guenter Roeck = 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 unrelated. I resend it because I rebased it on master. 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/pmbus/pmb= us_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_debugfs_get_st= atus, > > 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, data); > > + if (rc < 0) > > + return rc; > > + > > + data[rc] =3D '\n'; > > + rc +=3D 2; > > + > > + return simple_read_from_buffer(buf, count, ppos, data, rc); > > +} > > + > > +static const struct file_operations pmbus_debugfs_ops_mfr =3D { > > + .llseek =3D noop_llseek, > > + .read =3D pmbus_debugfs_mfr_read, > > + .write =3D NULL, > > + .open =3D simple_open, > > +}; > > + > > static int pmbus_debugfs_get_pec(void *data, u64 *val) > > { > > struct i2c_client *client =3D data; > > @@ -2801,6 +2825,66 @@ static int pmbus_init_debugfs(struct i2c_client = *client, > > &entries[idx++], > > &pmbus_debugfs_ops); > > } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_ID)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_ID; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_id", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_MODEL)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_MODEL; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_model", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_REVISION)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_REVISION; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_revision", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_LOCATION)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_LOCATION; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_location", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_DATE)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_DATE; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_date", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > + > > + if (pmbus_check_byte_register(client, i, PMBUS_MFR_SERIAL)) { > > + entries[idx].client =3D client; > > + entries[idx].page =3D i; > > + entries[idx].reg =3D PMBUS_MFR_SERIAL; > > + scnprintf(name, PMBUS_NAME_SIZE, "mfr%d_serial", i); > > + debugfs_create_file(name, 0444, data->debugfs, > > + &entries[idx++], > > + &pmbus_debugfs_ops_mfr); > > + } > > } > > > > return devm_add_action_or_reset(data->dev, > > -- > > 2.25.1