Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2162589rdb; Mon, 9 Oct 2023 15:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFc3i/1OqdclMybNZMeApxAw8zq19oP4j3p9lGpsG1GTJauglKsRjgv3NEaqQeYryjwj+/p X-Received: by 2002:a05:6808:23cd:b0:3a3:b39d:a8bf with SMTP id bq13-20020a05680823cd00b003a3b39da8bfmr20924469oib.45.1696889297348; Mon, 09 Oct 2023 15:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696889297; cv=none; d=google.com; s=arc-20160816; b=y6XD4CrO95Owndm9ijyPbjdYDlqP/3/6kHIvXeGtm7tEh3Dg6efgdi+OgoWJ8sa3Hk T8yaO4mavQNdf4suEZLw3BbN1mB/JdBzT61to18Sjf6ORXEE7EG/8Pj7mahIqZHYMmbr rYcV5r5fu8qfBfdTWSxlIVhnMVkqP59VlCn4Sjyb+0Ie4gh3JZxrji3TkAHVxW0a3gzS gGbNM4qE0h0VLpdKA7H6/8T6LGXR7j0yoo+PrBnEdUsZ338GGB8lcjVH5dzZS9WjX/Jl ay9/f10r0XBdV9YTixtnXgfbAtYBCwlhqLNs/QihGP4f5cYGEhRhjj3VnibXbAb5KRgO Sz6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PK/4pWTGCjdOHEqKXtfMi4G5FQYgjHaUgUwAY1I6iBQ=; fh=YG8RNYiaRDLG5BV5HYwUxtky3zoatFZPUzvo5U3RfCY=; b=tfPXPr7eqdBlnFSwyARimtiTwFeWCKF24MK8tEm7Pr1pJ245rhYWG3MbHO+9IRKq9S +8t1b5c1aWT3XR5j7ovh6I+c+N2gMsY9tHjwYN0WLRwvaueGCB4WNaNIIxZyqMUiESZa JYlkx94ywopCv24lw2oJ0boLJXyZnvWN+HwPMTGysAqX9jBX/2spV1bbemMbtMfBo9Bo wmjnyXRUvj50R01RKgVYkZOPQCQY8PwAqsLADAl7A2Lw+gRXe40n7dUVLhy/vTNrP8AL hBjnrZyI/sZwCpwTt7IpenritR1UBwiggBiPGXei0+MY6v6GUYDz5g/wOs3XYIVtQoB9 VR1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id l72-20020a63914b000000b005893b7094easi10142852pge.554.2023.10.09.15.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 15:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5A6C38078306; Mon, 9 Oct 2023 15:08:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378754AbjJIWH6 (ORCPT + 99 others); Mon, 9 Oct 2023 18:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377059AbjJIWH5 (ORCPT ); Mon, 9 Oct 2023 18:07:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3540999 for ; Mon, 9 Oct 2023 15:07:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C762FC15 for ; Mon, 9 Oct 2023 15:08:36 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD6533F5A1 for ; Mon, 9 Oct 2023 15:07:55 -0700 (PDT) Date: Mon, 9 Oct 2023 23:07:33 +0100 From: Liviu Dudau To: Rob Herring Cc: Sebastian Reichel , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] power: reset: vexpress: Use device_get_match_data() Message-ID: References: <20231009172923.2457844-19-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231009172923.2457844-19-robh@kernel.org> X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 15:08:10 -0700 (PDT) X-Spam-Level: ** Hi Rob, On Mon, Oct 09, 2023 at 12:29:14PM -0500, Rob Herring wrote: > Use preferred device_get_match_data() instead of of_match_device() to > get the driver match data. With this, adjust the includes to explicitly > include the correct headers. > > Signed-off-by: Rob Herring > --- > drivers/power/reset/vexpress-poweroff.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c > index 17064d7b19f6..bb22b2db5907 100644 > --- a/drivers/power/reset/vexpress-poweroff.c > +++ b/drivers/power/reset/vexpress-poweroff.c > @@ -7,8 +7,8 @@ > #include > #include > #include > -#include > #include > +#include > #include > #include > #include > @@ -108,20 +108,17 @@ static int _vexpress_register_restart_handler(struct device *dev) > > static int vexpress_reset_probe(struct platform_device *pdev) > { > - const struct of_device_id *match = > - of_match_device(vexpress_reset_of_match, &pdev->dev); > + enum vexpress_reset_func func; > struct regmap *regmap; > int ret = 0; > > - if (!match) > - return -EINVAL; > - > regmap = devm_regmap_init_vexpress_config(&pdev->dev); > if (IS_ERR(regmap)) > return PTR_ERR(regmap); > dev_set_drvdata(&pdev->dev, regmap); > > - switch ((uintptr_t)match->data) { > + func = (uintptr_t)device_get_match_data(&pdev->dev); > + switch (func) { > case FUNC_SHUTDOWN: > vexpress_power_off_device = &pdev->dev; > pm_power_off = vexpress_power_off; device_get_match_data() is badly un-documented but I think it can still return NULL if no match. At the moment we're checking for a match earlier and avoid calling devm_regmap_init_vexpress_config() needlessly, with your patch not so. Can you not replace each line with the equivalent code and keep the NULL check? Best regards, Liviu > -- > 2.42.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯