From patchwork Sat Sep 22 22:21:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10611577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C94BF17EE for ; Sat, 22 Sep 2018 22:21:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B81ED2A86B for ; Sat, 22 Sep 2018 22:21:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACC5D2A8B4; Sat, 22 Sep 2018 22:21:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40C8D2A8B1 for ; Sat, 22 Sep 2018 22:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725853AbeIWEQW (ORCPT ); Sun, 23 Sep 2018 00:16:22 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33935 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbeIWEQV (ORCPT ); Sun, 23 Sep 2018 00:16:21 -0400 Received: by mail-wr1-f66.google.com with SMTP id t15so8188975wrx.1 for ; Sat, 22 Sep 2018 15:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9Y/Wt90wAd/Y1ZITzs1DmPar9yMuBvVA1vfA9vk8u1o=; b=MGARRO99WopYr6gDlzjZEJB9TS03oj78r6jouSBLiQoWUPFZnjfQ6DXujqEQQZDjYJ 9JmF+e2T+NlttKDBTxBKmSImX1r4K/Sgp+nse/qQ1Brfu8WCmCP9N9bz+2I32uQmL3fK KEJYf5BeTNQfLy1SfVf6cGiMPzmjT7bihw4k9zKXYCNV/yz9RNi1fhmWCl4SoLPPWrzM h5u/7wPH/L2EIwX+tl6ADAd7kUcuY9e3Q6Oucg7zYEob4NpY+M2vmKWLI5/DsHLU150c +IOSQUXpvsnwDrEkbOafu8I68lRoNOioK3cSv+WbvBfYoxe11rlBUzvab2Q+4fUs9Fqu /VDQ== 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=9Y/Wt90wAd/Y1ZITzs1DmPar9yMuBvVA1vfA9vk8u1o=; b=YNKGJYKrD9ibwjGxOV8KTtR53J4YFvEUBXUPBQcSYUjRq0UbpQCMH5wy4WkEPlha69 eCWBQYgCwRLghWHc55+JLblwS8HMpwLoBgARX0Ho14h/KctveP/o+hZaY8cNuoShIiH/ y7f8poH5QbugqLWmAR1q+8qQlYle622w6tT0SegxAmzqLwOM1d+UyElZeXVUl5NkU1u/ PPw5KP9GSfgO6Rn2FhogyVdJLwJNJTQvcuqgl3QGuoZMRpb03cufxxbVkGY76vBvFupZ S8EDnvEDNpw9bkEsSH3ik7TK0JJkn4lYU3aPNrR6rbNb+Rg2nKM/PbkZTEUm6KI+ULVN 5l2w== X-Gm-Message-State: ABuFfoidohFTFt/H74geHVFE/oWrhOL0lZy2HcteDduxmcil2MLr613I FUdo5fREzlhAe1VuFXLDB0c= X-Google-Smtp-Source: ACcGV60KCUAF2Xk4DIHLxQ/KYU+Pif17covgKUfA9ifgwQmH4vgu7ldUjJv2SVr9hw7bReY+eiqnKQ== X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr3229258wrc.93.1537654872777; Sat, 22 Sep 2018 15:21:12 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD74AC30035FEEB5F4EC70873.dip0.t-ipconnect.de. [2003:dc:d74a:c300:35fe:eb5f:4ec7:873]) by smtp.googlemail.com with ESMTPSA id l16-v6sm6395499wmc.38.2018.09.22.15.21.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 15:21:11 -0700 (PDT) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-iio@vger.kernel.org Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, Martin Blumenstingl Subject: [PATCH 2/3] iio: adc: meson-saradc: use of_device_get_match_data Date: Sun, 23 Sep 2018 00:21:01 +0200 Message-Id: <20180922222102.12023-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180922222102.12023-1-martin.blumenstingl@googlemail.com> References: <20180922222102.12023-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This simplifies our _probe function by using of_device_get_match_data instead of open-coding it. No functional changes. Signed-off-by: Martin Blumenstingl --- drivers/iio/adc/meson_saradc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index b97b06bf7713..9d8f2139debc 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -978,11 +978,11 @@ MODULE_DEVICE_TABLE(of, meson_sar_adc_of_match); static int meson_sar_adc_probe(struct platform_device *pdev) { + const struct meson_sar_adc_data *match_data; struct meson_sar_adc_priv *priv; struct iio_dev *indio_dev; struct resource *res; void __iomem *base; - const struct of_device_id *match; int irq, ret; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); @@ -994,13 +994,13 @@ static int meson_sar_adc_probe(struct platform_device *pdev) priv = iio_priv(indio_dev); init_completion(&priv->done); - match = of_match_device(meson_sar_adc_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "failed to match device\n"); + match_data = of_device_get_match_data(&pdev->dev); + if (!match_data) { + dev_err(&pdev->dev, "failed to get match data\n"); return -ENODEV; } - priv->data = match->data; + priv->data = match_data; indio_dev->name = priv->data->name; indio_dev->dev.parent = &pdev->dev;