Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp980331pxp; Wed, 16 Mar 2022 23:20:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRNVz1xkSo+eDdzkP9iMi1PYj/SzWC2gKXVhCHfoZNL4J1MZH4i60T24BEZhNBXIXUQ0F2 X-Received: by 2002:a17:902:8203:b0:153:2e8:aaae with SMTP id x3-20020a170902820300b0015302e8aaaemr3473617pln.14.1647498028134; Wed, 16 Mar 2022 23:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647498028; cv=none; d=google.com; s=arc-20160816; b=ZAeiPb9/x2dwKiZAkJ+uAAK41nAy4AcATrF1wrppSsiIq71JbNE7v1g3JT++ebj+wQ /ooTHNZVvYvuadr/QX3JBZCXIRxAQwD+fpVNV/b28BxU9IV7NxmwfSbOubwGb241jJVt PCKlPrOecT0fNEiM8zGMNyZWSfi+DQnI8OvWX8kvctiQ4E3y5WERJi16m/Up67MxWKWb cF3GmPh0k+FkY3gANn9D7eoPsk1uSTf277O/H5XvSPv+fJfcw2Yb+37vWn68+Q6N6tu+ 5pPD7JVb522n9VBvk1WHfLeJ0edYGvI9R2gbFsaCh3I4s9B2A3XF8TQhR/3SsdKvTr8d U7eA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=WRmt8OEVoaWOh8laJSatF97Upa9zr/MymjKkHsOXX58=; b=VNrDkE5hxYcHWoVXSik6g0fYkmKLIVjgn09iJxl2AWoqkKF5X1ngb7VEJ71O/bdReM l6DzlTVLckmnEgtweli389jhPSjw/wdZrUbVCsmHkVJlZZNSGwYScBTUsnVdsEHf62ez D6sTAMoRh/IY5Tlg64Bk6d5XMbW6GmJV/uduQcrO6sVmfFqZmezGK3fOWHuL9wPy9FxF bzWLNSxx5vDRd0wIVp/9j3b0PLEQcTPFyp7IOw7b8rPWbhz7bUqo8B7bDaPFHGC3ATsM mgxaSTiuOYo6oNgytuRC5LFZeFI3c0kDQbcjvWlDUXiWjlbBn1CnGyDU/fsPkEDdB7bp SMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=O7hwlbyV; dkim=neutral (no key) header.i=@suse.de header.b="EYdv/BlB"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h10-20020a170902f54a00b00151f5a6e25esi4148141plf.553.2022.03.16.23.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:20:28 -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=@suse.de header.s=susede2_rsa header.b=O7hwlbyV; dkim=neutral (no key) header.i=@suse.de header.b="EYdv/BlB"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7FEB1667EC; Wed, 16 Mar 2022 22:05:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349964AbiCOQUH (ORCPT + 99 others); Tue, 15 Mar 2022 12:20:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235918AbiCOQUG (ORCPT ); Tue, 15 Mar 2022 12:20:06 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F281276F; Tue, 15 Mar 2022 09:18:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 841BD21901; Tue, 15 Mar 2022 16:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1647361133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WRmt8OEVoaWOh8laJSatF97Upa9zr/MymjKkHsOXX58=; b=O7hwlbyVgMB+GGlS0/U8ji7SNsE8ASleMMPBvebis6D0shSbuMqZHQHjOwBJ4TaAXezmBT mPf1KfRsWc10PpT8hv+Jjha2++tgTLJe4dE/ZPRr0LByYE/gvwBF9v1St1bzleCkxpZVDF rm62SR5c6OCQmaF2YCoP7IbAIjMblKQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1647361133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WRmt8OEVoaWOh8laJSatF97Upa9zr/MymjKkHsOXX58=; b=EYdv/BlBn6u8dFsYlEtc2T1+QqBK/ocq+WOebxmkLyaknXD3WmBg6f59oHzUZsd9yZ2QH+ xikocBP1uf2KL6Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 46E7113B4E; Tue, 15 Mar 2022 16:18:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LpOoD228MGK3PAAAMHmgww (envelope-from ); Tue, 15 Mar 2022 16:18:53 +0000 Date: Tue, 15 Mar 2022 17:18:52 +0100 From: Jean Delvare To: cgel.zte@gmail.com Cc: linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: Re: [PATCH] hwmon: (scpi-hwmon): Use of_device_get_match_data() Message-ID: <20220315171852.3b2f1dc4@endymion.delvare> In-Reply-To: <20220315023412.2118415-1-chi.minghao@zte.com.cn> References: <20220315023412.2118415-1-chi.minghao@zte.com.cn> Organization: SUSE Linux X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, 15 Mar 2022 02:34:12 +0000, cgel.zte@gmail.com wrote: > From: Minghao Chi > > Use of_device_get_match_data() to simplify the code. > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi > --- > drivers/hwmon/scpi-hwmon.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c > index 919877970ae3..5187c6dd5a4f 100644 > --- a/drivers/hwmon/scpi-hwmon.c > +++ b/drivers/hwmon/scpi-hwmon.c > @@ -141,7 +141,6 @@ static int scpi_hwmon_probe(struct platform_device *pdev) > struct scpi_ops *scpi_ops; > struct device *hwdev, *dev = &pdev->dev; > struct scpi_sensors *scpi_sensors; > - const struct of_device_id *of_id; > int idx, ret; > > scpi_ops = get_scpi_ops(); > @@ -171,12 +170,11 @@ static int scpi_hwmon_probe(struct platform_device *pdev) > > scpi_sensors->scpi_ops = scpi_ops; > > - of_id = of_match_device(scpi_of_match, &pdev->dev); > - if (!of_id) { > + scale = of_device_get_match_data(&pdev->dev); > + if (!scale) { > dev_err(&pdev->dev, "Unable to initialize scpi-hwmon data\n"); > return -ENODEV; > } > - scale = of_id->data; > > for (i = 0, idx = 0; i < nr_sensors; i++) { > struct sensor_data *sensor = &scpi_sensors->data[idx]; Reviewed-by: Jean Delvare -- Jean Delvare SUSE L3 Support