From patchwork Tue Apr 20 11:39:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12213871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AD8DC433B4 for ; Tue, 20 Apr 2021 11:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9CE1613B4 for ; Tue, 20 Apr 2021 11:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232006AbhDTLkM (ORCPT ); Tue, 20 Apr 2021 07:40:12 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39124 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231945AbhDTLkJ (ORCPT ); Tue, 20 Apr 2021 07:40:09 -0400 Received: from mail-ed1-f71.google.com ([209.85.208.71]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lYojB-0005VD-Mj for linux-samsung-soc@vger.kernel.org; Tue, 20 Apr 2021 11:39:37 +0000 Received: by mail-ed1-f71.google.com with SMTP id bf25-20020a0564021a59b0290385169cebf8so5561207edb.8 for ; Tue, 20 Apr 2021 04:39:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z90S5N2Vf8o3affpqAJ/qKsRULU7kNCm7WTR7sGPJFI=; b=fUrxfKRZ0zEyDXtG6tjBG2FvTpgu9v3BrXqpq25pnRXm+VojNo7nzoh6rtG6VcZN3U PIo5r2MSY241KsC3OzZDx9l1SDdwEsk96WnUedV7Ol0ITVICqmtXNSezc+Znp5hKerk9 kVAww72TgfZrOUICSctcbde/EYp44k6kX2E0h3nnnxp0EDs7uRaA6kHIe0uLSWs/8osQ bw+W8RFcus2b/JIP3oG6A0RUw+p0iVDrwTMR7YIa7Mn2Hjl6lqDwan/mo32ZrPKc3Ezn 2aLUC2vxy5y2hnzxFC2q7Dc5ja+EWL+bdSFnJgS6iI/ucoA4F53kAGGjgZHNXHl/38yb weVQ== X-Gm-Message-State: AOAM532808OwPts372Mv71S4OvCQt4m7vcj3ze7h3j1h2EdujZ4Z30Gu gflKypCHtR7QUFnq+5oKVtQgq7tkaznTO5GDMok2j7nBt5uaadYD2GUpywZ75VJ1BT8auQ4VF+b 0+QUPnDPcezYV1+p80IJlNtkmfrgxmHJj8duMPZ6OcrurcC3P X-Received: by 2002:aa7:da15:: with SMTP id r21mr31299677eds.253.1618918777054; Tue, 20 Apr 2021 04:39:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDLe7voWiCNzz20rbTRMwYK/knYegMngT8XRwqFQSN5JSDPctogln3VwQ/zsXtlLbeBhoQVg== X-Received: by 2002:aa7:da15:: with SMTP id r21mr31299662eds.253.1618918776947; Tue, 20 Apr 2021 04:39:36 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-180-75.adslplus.ch. [188.155.180.75]) by smtp.gmail.com with ESMTPSA id bw26sm10109007ejb.119.2021.04.20.04.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 04:39:36 -0700 (PDT) From: Krzysztof Kozlowski To: Support Opensource , Lee Jones , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tony Lindgren , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org, patches@opensource.cirrus.com Cc: Marek Szyprowski , Sylwester Nawrocki , Adam Thomson Subject: [PATCH v2 4/7] mfd: da9062: Simplify getting of_device_id match data Date: Tue, 20 Apr 2021 13:39:26 +0200 Message-Id: <20210420113929.278082-4-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420113929.278082-1-krzysztof.kozlowski@canonical.com> References: <20210420113929.278082-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use of_device_get_match_data() to make the code slightly smaller. Signed-off-by: Krzysztof Kozlowski Acked-by: Adam Thomson --- Changes since v1: 1. Add Ack 2. Correct subject prefix --- drivers/mfd/da9062-core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index 8d913375152d..01f8e10dfa55 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -622,7 +623,6 @@ static int da9062_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct da9062 *chip; - const struct of_device_id *match; unsigned int irq_base; const struct mfd_cell *cell; const struct regmap_irq_chip *irq_chip; @@ -635,15 +635,10 @@ static int da9062_i2c_probe(struct i2c_client *i2c, if (!chip) return -ENOMEM; - if (i2c->dev.of_node) { - match = of_match_node(da9062_dt_ids, i2c->dev.of_node); - if (!match) - return -EINVAL; - - chip->chip_type = (uintptr_t)match->data; - } else { + if (i2c->dev.of_node) + chip->chip_type = (uintptr_t)of_device_get_match_data(&i2c->dev); + else chip->chip_type = id->driver_data; - } i2c_set_clientdata(i2c, chip); chip->dev = &i2c->dev;