Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp934983pxb; Fri, 22 Apr 2022 14:45:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH4pEA8hXDn0QWrFUBUFEAq0MmklkiATJfzBoAdw2zP2obNmj/UoJFwlqPLlAc1ozPnT1M X-Received: by 2002:a17:902:bf09:b0:153:99a6:55b8 with SMTP id bi9-20020a170902bf0900b0015399a655b8mr6587165plb.142.1650663921400; Fri, 22 Apr 2022 14:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663921; cv=none; d=google.com; s=arc-20160816; b=qUnPUb3uCwqLNuVH2ySjRLcZ/d2p5wczq4KqJawCtm97hYKbS/fvYeyGYe0YcocYlv nThtoZE9lfjFr36Jl3n9SP+ZElJp9uoqMhaohtA0V1UCiwfy2FcM4QZVqMOmZ7rtnUG6 ani8kq6R+OgjlcrR4nOzFE95BiUod7aNiHr3gQ9y+HTrCh9C9Ii79AykwQHPvbrAzAUE Pozi6vUpUEP7BWz0tTaUq4id61mAkyTq9kgvOG7M7Hg2VCH8Mui07wOQOSsMuSKML0Zw FLWlGtrLcpmX1PtZSLgo9Ub1fnMMJECBSXwULKXKknBj3UK1uVDW/+I/zDivQCXB+KeX Z5tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:sender:dkim-signature; bh=xUUVhcCV2MnLvckxNQgFIVhxYpI9BwVhaob+8jFGxmE=; b=LhQz9StclfX33zvA52VpE8E8UX+tuCeATQvAuQh/SDhv73AyEIX1B5+G3DrpY95P/d lxPG1CpMzG/1KDaFr4N3ztJ0V/P7+NJVQ3wPnJfHfVfZN1e3BsUnRFXgViUN9UCd40nk NJjxiCALwO9fLR9w5h6TdVLHcgeuHID/ed+KvhsX1Iv2MKBXHB3tg5bP+N13qKp0nJfX itTIGMYFcahWGnkRDlX0FIDNmgX0vT5FUSqJw0fHDBkYGmeqlywTXap28wxSGH1fgn90 9t8A3RvxeOl+6W6pUB9bwVCXt5vkZBNlH0oqd/LTAWkrXshLkQuN/PZiEEPsNS2B6dP6 DQXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oc2C+JoZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k11-20020a170902d58b00b00153b2d16660si5329580plh.616.2022.04.22.14.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:45:21 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oc2C+JoZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D6B2332A9C9; Fri, 22 Apr 2022 12:53:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380281AbiDTQJT (ORCPT + 99 others); Wed, 20 Apr 2022 12:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380158AbiDTQJO (ORCPT ); Wed, 20 Apr 2022 12:09:14 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70DA130552; Wed, 20 Apr 2022 09:06:28 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-e2afb80550so2434497fac.1; Wed, 20 Apr 2022 09:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:content-language:to :cc:references:from:subject:in-reply-to:content-transfer-encoding; bh=xUUVhcCV2MnLvckxNQgFIVhxYpI9BwVhaob+8jFGxmE=; b=oc2C+JoZAcCa5ezslIwZxLQJIZwS49mZnJKCFyXLCYAXqB/J9OXfL7g6jibOS/6oNv nr2SE8Z7cH0Zs74f65Er1RV1/K6UdES7yjVwcD7zz+amDcqM1hw9fMxUSQKayJ8Rw+H0 NOERztMpRK//cZU5FUbfwBRYEP82fwFwpN6NnyoNzurl1DJCIsB4nxfjXVhpWUbbBA55 3wXz/jC9TokskhGMDpoTBTS4PyJym80DvZ7fO77/yR+bbO/FYBt6BmNxJaL0L5EzzCsE 59DTCusR7JSquzgssb/im89wP1GziIPHexlplgrAHVU7c39rvEeXBUcCy7VfYDRfl57s ohOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=xUUVhcCV2MnLvckxNQgFIVhxYpI9BwVhaob+8jFGxmE=; b=yCgUQk5su2Bclfo916pybQjtEb/iumdUQvrA4D8WguBjGSURP/rYiiBW0ofYvUduaY lL7hXM2rOPtEGhoPurVhtMcSHSceDQQixGq1Rr3lt40AT+ONcGXZIr5y1846cc2Ayz/5 HIWOrTaSQTMWvj9hN2FPa2agdqS9M+ldqKAcNbL6KjOx6YLApdl+WrGSE7QWOSkZpCRO nY1tX+vCTYwTX1OEzoIJ1BLPhkr2XKdsntEV/Y+2VsI21/JEvBTTLVHsfROx9oxl+tBy 9f8sKfEhZvDofUH5W+tiqf+IfxbZNoIv/xkVCG9qm2YWaeD/9KdiE2wGl/Ml9NLdqezS Dchg== X-Gm-Message-State: AOAM531DUqgpS0N8uRQomnzOVT480pYrxgcw9R/rPn7x5dI18SHIMge3 0By1agns+1Sw/mh1HsOgrggWysPmUO4= X-Received: by 2002:a05:6871:793:b0:db:360c:7f5e with SMTP id o19-20020a056871079300b000db360c7f5emr1921012oap.218.1650470787745; Wed, 20 Apr 2022 09:06:27 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id a3-20020a9d5c83000000b006054c7ecfb6sm3705539oti.34.2022.04.20.09.06.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Apr 2022 09:06:27 -0700 (PDT) Sender: Guenter Roeck Message-ID: <1b12cb3a-3d87-8254-b229-dcf83ad0bc0a@roeck-us.net> Date: Wed, 20 Apr 2022 09:06:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: wujek dev Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220419215326.309991-1-dev_public@wujek.eu> <20220420122128.411757-1-dev_public@wujek.eu> <6f697b2c-58aa-6ca4-966b-147bcc184dad@roeck-us.net> From: Guenter Roeck Subject: Re: [PATCH 2/2] hwmon: (pmbus) add MFR_* registers to debugfs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 On 4/20/22 08:51, wujek dev wrote: > ------- Original Message ------- > On Wednesday, April 20th, 2022 at 16:15, Guenter Roeck 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 unrelated. >>> 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/pmbus/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_debugfs_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 = file->private_data; >>>>> + char data[I2C_SMBUS_BLOCK_MAX + 2] = { 0 }; >>>>> + >>>>> + rc = i2c_smbus_read_block_data(entry->client, entry->reg, data); >>>>> + if (rc < 0) >>>>> + return rc; >>>>> + >>>>> + data[rc] = '\n'; >>>>> + rc += 2; >> >> >> Why +2 ? >> > Copied from another driver. > +1 due to '\n' > +1 due to NULL character (smbus block transfer does not include it in the length) > Explanation included in v3 patch. "copied from another driver" is not really a good argument. That other driver might just be buggy. 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 ? Guenter