From patchwork Tue Sep 19 18:44:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9959959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9E9B60568 for ; Tue, 19 Sep 2017 18:47:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9FA7200F5 for ; Tue, 19 Sep 2017 18:47:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EA6F205AB; Tue, 19 Sep 2017 18:47:34 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40983200F5 for ; Tue, 19 Sep 2017 18:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=q+zO3FvziGgmuyBcebEXgJlxW2v1FGQw3df6fK0tx+M=; b=hu5 DGE49mVTfjN5vSGaiHQVR8PnIFec3t4eEDrvjex88gnYZQI8Mlb/Bgx3TiGE/HbBK6GnFFdCUpSNh 7YcOgRcchP/J25LgbQNdMVOpjbrGr+ozplXaWa1xV2G/NvlsyG0eMfqW2rWG5HsbEAXhm+lobxOAq HyM7SYit2PjDQzjoreVjc8icVVPVl6k04+Cguxgxb8790RuT9lgtp2/oT/N+qzHe0XWQeOvXsVTBg rjCAuEzInOTO64FaEWQYTDkdW79FBVCNJuOxU2cLqwx+TjzhzKDnYaKpy4OWvjNZDAYLCJFPat04A f5FTjPSidNcpQ6K0X9qtjXeidG1eo/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duNYM-0005A2-TL; Tue, 19 Sep 2017 18:47:26 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duNYJ-00056e-3r for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2017 18:47:24 +0000 Received: by mail-wm0-x242.google.com with SMTP id x17so426772wmd.5 for ; Tue, 19 Sep 2017 11:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8btbBxIkhrvn44g9b2hNQpUyUTJgUgfPExMhKcCZE2k=; b=Ts+AeAX2Y7GYbJIbUsX5qiPhk3Et1f/CSEZkF3mo0SJa5E0iS9rRopqRfHibojPsYW RFpk5nkOYIsGlmwwFn/G88UocA82e+hTEKLoFnQbeYdBz4ieAas3tZwN4fVQK7HkRbAu 9fPy9BI6Dd862UQnfoSaWsaXzHut8azFAedaiuO/WolJmgyMxL1CjJfww+mSca1cJMCf /uZjpSnGcB+a5pmqKSQivX5jEzE6QjVuh1yicRh7YlEGQkSV695M7K3HB+k0zQgKmtjl D7wgMsk5QmV1s4ApucYFZOVS7J/TRe5q2pt9HoYJy5368vC2lMdo04ufe2/0o90CkKQE 787g== 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; bh=8btbBxIkhrvn44g9b2hNQpUyUTJgUgfPExMhKcCZE2k=; b=Hx7yVJVMA39zNNSieWeq6EVYrQ8ZcO9Hq5g24Fdnrs91nZvBK9d8AmDqX2nxC+MzRs EVoO+2cUtd4lNyuZS6HEEgUTUPNxtgwuXat+QeNOgNU5QtNWo3sj8DmI634QZ6fxYyOc MRtimE4IWQ9PHoSWlG5cUamgFkqc+ijEvoxA5chCHGJRYDCGvjUxRohgoEcM177wotsO tx6CLZUu4jbdRAZnV7MMirHwL9Z1HQMWFgqEWQ7Cfc8tmk+4MkpzhkMRw/JsBQCHNY6m g11najH0k0pFodkEpsYjm1jsFx516VkBeqmuMhBxr7d47vLE4u6gAD5SRSm4mIAdV4Wd 76rw== X-Gm-Message-State: AHPjjUgoHk0mLAJ+tifmaryZuqNvqFLVyiS81KIekFeDyr7RaCzK9DuL aSK7i8HESOpzSpnGNTYEE+Y= X-Google-Smtp-Source: AOwi7QAWnDvaqVoPq5QSdNjXB5QCAj//zAnHAtf9z5RKtJHVHZAxfWc2TlTJHupfhnQMsZ2ApQBI/g== X-Received: by 10.28.223.87 with SMTP id w84mr2049197wmg.148.1505846820961; Tue, 19 Sep 2017 11:47:00 -0700 (PDT) Received: from Red.local (LFbn-MAR-1-580-96.w90-118.abo.wanadoo.fr. [90.118.159.96]) by smtp.googlemail.com with ESMTPSA id f43sm12665470wra.79.2017.09.19.11.46.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 11:47:00 -0700 (PDT) From: Corentin Labbe To: vinod.koul@intel.com, dan.j.williams@intel.com, maxime.ripard@free-electrons.com, wens@csie.org Subject: [PATCH] dmaengine: sun6i: sun4i-gpadc: use of_device_get_match_data Date: Tue, 19 Sep 2017 20:44:47 +0200 Message-Id: <20170919184447.4479-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170919_114723_317515_E0781324 X-CRM114-Status: GOOD ( 10.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dmaengine@vger.kernel.org, Corentin Labbe , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The usage of of_device_get_match_data reduce the code size a bit. Furthermore, it prevents an improbable dereference when of_match_device() return NULL. Signed-off-by: Corentin Labbe Acked-by: Maxime Ripard --- drivers/dma/sun6i-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index bcd496edc70f..584f4e82a9be 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -1064,7 +1064,6 @@ MODULE_DEVICE_TABLE(of, sun6i_dma_match); static int sun6i_dma_probe(struct platform_device *pdev) { - const struct of_device_id *device; struct sun6i_dma_dev *sdc; struct resource *res; int ret, i; @@ -1073,10 +1072,9 @@ static int sun6i_dma_probe(struct platform_device *pdev) if (!sdc) return -ENOMEM; - device = of_match_device(sun6i_dma_match, &pdev->dev); - if (!device) + sdc->cfg = of_device_get_match_data(&pdev->dev); + if (!sdc->cfg) return -ENODEV; - sdc->cfg = device->data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sdc->base = devm_ioremap_resource(&pdev->dev, res);