From patchwork Mon Oct 9 21:13:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 150331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2124447vqo; Mon, 9 Oct 2023 14:14:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhkyn45s0hqvkwW7gzenAhqgV0NgyQI6JbgQdxplmSJ/yiPpJ3C0dTXKiAQdklu2t6+ZFc X-Received: by 2002:a05:6a00:3a02:b0:68f:bb02:fdf with SMTP id fj2-20020a056a003a0200b0068fbb020fdfmr18597174pfb.27.1696886076480; Mon, 09 Oct 2023 14:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696886076; cv=none; d=google.com; s=arc-20160816; b=T67Te3DNijRCL4f+WPc2FHCLqyKGrDZiJ4oC74dfrHBIg27p8vdwslZsY6a7h5L3b+ ANG0D/ddBUzvB7zcpcZVNeeSveO2goZHA+/aGdqIn1VBUv0BaZ0ZzgOPL12pUea6IIVx bBgwXuIhgE18skl8dINQLtF8UYu0p1EZ+fcTbMhoZq4AVCReKDSerAeR7zCs8XoqB1CM X1qmJKQA2bP1NrJbt/c1HkLnxPt67W7cgKVLqaXvc9GYXxZRawzMHVYTI6lEJNQGGuQs 3yLjuhPrYe8Nn8eXiCQZlI/Xq9ch6E77H7OvKN6Uvir0Klgb165Xhx4VFUVkxdcYLnqI NjyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=RjMxNklY9G/+xqQ/lM5xPuWR9yO1uXO1qqREMwyoCLU=; fh=f7kKwzmL5vxF4veDVPOUXfdfrXE6R1bevnyo30p5Vps=; b=Q6XpvPUgcu+WDqMgvJ2/c+Bypi1B29AO3SUOd3z6p2V5Ba9qs5byB3CjdcAU5KSBGg 67Qa6aGy8EjPhP6E8nqbj/O/U3JxtUEWPOKReIW+VjpnJRwSyr6HrOhCtxd1OmWyrL8j sFPZ2lmcv9CnOLnsmE/IqgzVvrXb9Xa+4cS3smc0B8iNRIrIUnVfayRoWdqnAX0pyUJm fwKOUNHjs7cZLnf1vnNz1dOFNlCNsRi8LuVpvWROVk4z5YKrkgu3XkmKkz9BNFrVneY2 KKDzFOZBAu6q1ecVbi2gbssus+Rc6goNEtp7IITHgg9drBElje3+wM6lB5jWwMghPMl5 lVZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="k/XXo9gc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e11-20020a65688b000000b00584b9d0ff81si10061229pgt.635.2023.10.09.14.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 14:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="k/XXo9gc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7332280E6590; Mon, 9 Oct 2023 14:14:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378693AbjJIVOX (ORCPT + 19 others); Mon, 9 Oct 2023 17:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378672AbjJIVOS (ORCPT ); Mon, 9 Oct 2023 17:14:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8573B6 for ; Mon, 9 Oct 2023 14:14:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8730C433C9; Mon, 9 Oct 2023 21:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696886056; bh=92q9941Hk6m7vrKfgjduGlCt6AEAywwnij4Ddy51frE=; h=From:To:Cc:Subject:Date:From; b=k/XXo9gc9QlbY1l77U8Bza5aj3POoieELBtW3oTcLKEroFgmzY6hF8Z6WnLXPKVmi k3j4xeehd3SO9gEkK4GtqhpbS8WImuaArc39fUXNX7/XmiVR+K+Tdilkw0IKLKlLkF 1ZwdvRV9LBMWEQ+ZWQkqOdqK1ldsC+gyUXqLlVQTPH0BHA7mdu2sduId8SAW3H9aCm qFmsiiTnS+fvk8Jv8C1rlZ8sxD7KTapWGpEDedbg7h31jw9GYnONqLZTge1xLbzHX2 o3OVukaYWdF7WkhoQOiuEc9muxD3YRfHO+FhWDD7DOtjXSjuRg3+WRjxlwdH3p3LNE pql0COKbli3mQ== Received: (nullmailer pid 3245828 invoked by uid 1000); Mon, 09 Oct 2023 21:14:11 -0000 From: Rob Herring To: Support Opensource , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org Subject: [PATCH] regulator: da9121: Use i2c_get_match_data() Date: Mon, 9 Oct 2023 16:13:38 -0500 Message-ID: <20231009211356.3242037-8-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 14:14:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779314014618321445 X-GMAIL-MSGID: 1779314014618321445 Use preferred i2c_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/regulator/da9121-regulator.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index 80098035bb13..b551a400bdd1 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -13,7 +13,7 @@ // // Copyright (C) 2020 Dialog Semiconductor -#include +#include #include #include #include @@ -1117,17 +1117,6 @@ static const struct of_device_id da9121_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, da9121_dt_ids); -static inline int da9121_of_get_id(struct device *dev) -{ - const struct of_device_id *id = of_match_device(da9121_dt_ids, dev); - - if (!id) { - dev_err(dev, "%s: Failed\n", __func__); - return -EINVAL; - } - return (uintptr_t)id->data; -} - static int da9121_i2c_probe(struct i2c_client *i2c) { struct da9121 *chip; @@ -1141,7 +1130,7 @@ static int da9121_i2c_probe(struct i2c_client *i2c) } chip->pdata = i2c->dev.platform_data; - chip->subvariant_id = da9121_of_get_id(&i2c->dev); + chip->subvariant_id = (enum da9121_subvariant)i2c_get_match_data(i2c); ret = da9121_assign_chip_model(i2c, chip); if (ret < 0)