Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp919697lqh; Sat, 1 Jun 2024 01:41:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYSepwLkQ2KffgYH1K30GsKMGpTHi4vTX3C6FlBqviG06RjJZX2h5thJOIYWQcwf8VJ88cJmaiI0FxEndBs0HWXBxkrsuJTAEcZs8RSA== X-Google-Smtp-Source: AGHT+IESqKajUL/QC6q52ZiNyFBwEJrmZihA9bwJlGPH4ne25F5wE8KDMCKg1KiE0wLgLre9V+3U X-Received: by 2002:a05:6214:5789:b0:6ab:6d70:898a with SMTP id 6a1803df08f44-6aecd571fcamr39874566d6.8.1717231267448; Sat, 01 Jun 2024 01:41:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717231267; cv=pass; d=google.com; s=arc-20160816; b=WjHX4feqyQ9xNDlBJ98GJFWgC1tgZ0OWkl+xLjpc5DpC1lCuP6j9Ru+dKCZY1whd7l gxMnkN0q7ZasdnHXxnPd+YrpYXaYIGKxLiSQfiXwwVlXcRXSOh2/HTwuB2BDdQfacmEi Ipswx0SIcgzFDj0Rg4bgL24qvAKpIlJODmlbuDhP9koiWLpjWJ8pxB15fCBngbow9mr7 VUjYEgEZhwUjq2ejYqmigcOCphqLAJCSV+H+viefATu3dBt5mgsjOtfn9s4nBCY/x9l7 IEfaKmCfvsjfv/uEFbeZQZjTyGzevlp9JW9cePCzK2ipXy/Yda+Ttl2/IlDlzaHN3ybM TXlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=uDIWi5FqRaEs9zERfH9KwqhtLcINKRmqH7+cDO7juLM=; fh=hZqWh28MfG4rRHjSGF9o71ZS7UETYshG8e5RfYNR7os=; b=rDFdU4qNvMSIU5AOESX1TaDYgz3E+Lt9mJT8lrkxiUSYjxAt3f5OaSnyUidKRIlZCr lbQt0nBrQQjx+6h+LNlOY53xWPJas1hED7FD5O/dcf9qK+KqxsfgNBNQYC6oEGSoR51W 9ry3E0HTed1E88oO32n+nSg5SoWbcYZVmg2wYOuCic1i3pz0eyCBzcXvjjzTLREU0QNB tG+mg4P7ijO4fuMDXPFcxdCf/p+DmnjXTLrqjC9nKTedjB9CWBWGddv9LXwpIFg9xUle rgRl5BKSnqj+6+FpxJMgheWzfNTbPBUMS6lAtM3TafMTFZANBnE1ZmOjVsiue5Gle5SB aOGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=CcxAMN5w; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-197773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b401f95si41252346d6.260.2024.06.01.01.41.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 01:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=CcxAMN5w; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-197773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2DF281C21F62 for ; Sat, 1 Jun 2024 08:41:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4F5020DE8; Sat, 1 Jun 2024 08:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="CcxAMN5w" Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C65111AD; Sat, 1 Jun 2024 08:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.26 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717231254; cv=none; b=j/EVCrayk0D44LngwfTJD0DZ5i8L4uoJGxcr1Sz5GxBcMS2psvHLJJsQ9FDP65IxRA2J49d7O9mO9F2Eirl35EJ4esHSVZxq/gD0r8FtQ3U2KdkrFyCEcBb8Zh9rYFNGJh3Js5ebCdIT1jqZU490UZ4bbTRFJ97oOOJgtYauZbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717231254; c=relaxed/simple; bh=sF9BOyKHST//ueP1dpjJq4rkoGLKuLDyhaBu4xILE54=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MWdYyztJ63GTq+BrUshMjSpU15IKaNNMSFEu5CK65d75GPcLdDkucQcC4TyLS+P7CelZ0p4ErCB+9EPDtihrVrT0g3e6c2XZ+SgXnjA2pIky8/biJl7oFBfuhEBqW/V+mlXP7YiB+lx5TNad+hfc5g0QPZfkpp9Nn0Oq2dCjGr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=CcxAMN5w; arc=none smtp.client-ip=80.12.242.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from [192.168.1.37] ([86.243.17.157]) by smtp.orange.fr with ESMTPA id DKH2sUFIEvZ5mDKH3sPIqU; Sat, 01 Jun 2024 10:39:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1717231181; bh=uDIWi5FqRaEs9zERfH9KwqhtLcINKRmqH7+cDO7juLM=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=CcxAMN5w2n9SUWnzDnMjSIrDMG65v2mbI47yhBc7lDTBy+QT2U1zeA2Zi1+xfFA1E uovCvYQ4AVbyrGVIDqto0QFZLbqwVPyobv8ECOw9e+Qk1y/LN8ZlqLA6NRpU0Sj+sg D4jm+8QIy6/42X3QGJUj7rJHwkXYTQilB2Du8QlgWPgln7uKM9uc+vFg1+LaNERq5M Kb17JpWUQJj2K75X6Y9adyGwXBGDWQQg518Gce6Uwrfw1Eu+XC661tph7pYgrLQXNA tJC/lDguYLxMx5jvz4vYAwSb+N1RifGvitqdBNQRH2LjZQnG7dt++uCsNl1COoIKNt dlM0iW41EnxxA== X-ME-Helo: [192.168.1.37] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 01 Jun 2024 10:39:41 +0200 X-ME-IP: 86.243.17.157 Message-ID: <446b396b-753c-4114-9a8c-6f84ad3a69ba@wanadoo.fr> Date: Sat, 1 Jun 2024 10:39:29 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [v3,1/2] hwmon: add MP2891 driver To: Noah Wang , robh@kernel.org, krzk+dt@kernel.org, linux@roeck-us.net, conor+dt@kernel.org, jdelvare@suse.com Cc: corbet@lwn.net, Delphine_CC_Chiu@Wiwynn.com, peteryin.openbmc@gmail.com, javier.carrasco.cruz@gmail.com, patrick.rudolph@9elements.com, luca.ceresoli@bootlin.com, chou.cosmo@gmail.com, bhelgaas@google.com, lukas@wunner.de, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org References: Content-Language: en-MW, en-GB From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 31/05/2024 à 09:26, Noah Wang a écrit : > Add support for MPS VR controller mp2891. This driver exposes > telemetry and limit value readings and writings. > > Signed-off-by: Noah Wang > --- Hi, below a few nitpicks, if it make sense to you. ... > +++ b/drivers/hwmon/pmbus/mp2891.c > @@ -0,0 +1,608 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Hardware monitoring driver for MPS Multi-phase Digital VR Controllers(MP2891) > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include It is usually prefered to have includes sorted. > +#include "pmbus.h" > + ... > +static struct pmbus_driver_info mp2891_info = { I think this could be const. > + .pages = MP2891_PAGE_NUM, > + .format[PSC_VOLTAGE_IN] = direct, > + .format[PSC_CURRENT_IN] = direct, > + .format[PSC_CURRENT_OUT] = direct, > + .format[PSC_TEMPERATURE] = direct, > + .format[PSC_POWER] = direct, > + .format[PSC_VOLTAGE_OUT] = direct, > + > + /* set vin scale 31.25mV/Lsb */ > + .m[PSC_VOLTAGE_IN] = 32, > + .R[PSC_VOLTAGE_IN] = 0, > + .b[PSC_VOLTAGE_IN] = 0, > + > + /* set temp scale 1000m°C/Lsb */ > + .m[PSC_TEMPERATURE] = 1, > + .R[PSC_TEMPERATURE] = 0, > + .b[PSC_TEMPERATURE] = 0, > + > + .m[PSC_CURRENT_IN] = 1, > + .R[PSC_CURRENT_IN] = 0, > + .b[PSC_CURRENT_IN] = 0, > + > + .m[PSC_CURRENT_OUT] = 1, > + .R[PSC_CURRENT_OUT] = 0, > + .b[PSC_CURRENT_OUT] = 0, > + > + .m[PSC_POWER] = 1, > + .R[PSC_POWER] = 0, > + .b[PSC_POWER] = 0, > + > + .m[PSC_VOLTAGE_OUT] = 1, > + .R[PSC_VOLTAGE_OUT] = 3, > + .b[PSC_VOLTAGE_OUT] = 0, > + > + .func[0] = MP2891_RAIL1_FUNC, > + .func[1] = MP2891_RAIL2_FUNC, > + .read_word_data = mp2891_read_word_data, > + .write_word_data = mp2891_write_word_data, > + .read_byte_data = mp2891_read_byte_data, > + .identify = mp2891_identify, > +}; > + > +static int mp2891_probe(struct i2c_client *client) > +{ > + struct pmbus_driver_info *info; > + struct mp2891_data *data; > + > + data = devm_kzalloc(&client->dev, sizeof(struct mp2891_data), GFP_KERNEL); sizeof(*data)? > + if (!data) > + return -ENOMEM; > + > + memcpy(&data->info, &mp2891_info, sizeof(*info)); > + info = &data->info; 'info' is not really useful. It could either be dropped, or initialised 1 line above, so that it can be used in the memcpy(). CJ > + > + return pmbus_do_probe(client, info); > +} ...