From patchwork Wed Sep 20 07:24:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9961027 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 7915860234 for ; Wed, 20 Sep 2017 07:26:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BE8228FDD for ; Wed, 20 Sep 2017 07:26:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60A7328FE0; Wed, 20 Sep 2017 07:26:42 +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 EFBEA28FDD for ; Wed, 20 Sep 2017 07:26:41 +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=4tz1Rwu3Sosyna8zzjYhYKR8+J4wCJlxikG98T+vOhQ=; b=lZ3 yORFQn8gAp/TVR37X8eHrcaU2Ul08sfugMaZdCyutCsdnJJwQgZLnV+WHiG6KTYmXq4G3ybdjM+9t M9QELn+1UqyWz5YOV6LtOVCmfXLXc0F72jPau3aq3ur9Z99YSrZTJeHhjw3HGanLAHYAqNWkx/kzM TPaJKlJlQ0ozomwH62ynAq+99aQ62Ml4yGhSX99SGZ68fYd2B+GonY1zIzEAA0eC+Db01Ed/qjza5 J0l4a5HwvADrfsSLq2x88N+BmKVqq1smxDcucrxJyY16EX8QKpjHuinJ55WtgN+QTLV0WxmpOQg3R EvQKQvHcm83/Ln7hBbp4iI4aggg/NFQ==; 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 1duZP3-00025i-9f; Wed, 20 Sep 2017 07:26:37 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duZOy-0001z3-72 for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2017 07:26:34 +0000 Received: by mail-wr0-x244.google.com with SMTP id n64so962053wrb.2 for ; Wed, 20 Sep 2017 00:26:11 -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=M7Yy/2eQ20QJNtbO7xTD0QddHArKQeZySLc3vaLUwFQ=; b=scXJWxeb2yaxC54Eqty1IuZzHFMu+Sjj1zqkvnNV4iITWNMUmpml/ey5uKqzIVvqol HPRwPbLnVTYTVCv0kh5TyuYHA+wUjpYdxVIWpM1d18+RMtvoceLBAiuuRuhngCec0+dR SrngUlceRviYKuTx6MwkECNTULDbJinR78iwTiAFHSnEN+JmcfhYHT0/7WNbCl46xuyu SWB8Al/7dXB0EyyIXkAvD876YHTgwLdnDG+wTdbMK5Cz8WpdhJL6SoBxFiDmbsN7rX1K Z2RZd7BPL/J1mkcSEQ7veqr1pL7b++A4C4zWCU2/8OsWnZ+snNdFnaFbt3PBsT53hC5+ 85tQ== 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=M7Yy/2eQ20QJNtbO7xTD0QddHArKQeZySLc3vaLUwFQ=; b=D3XaR3PODW8OeOqTrfGfkDAxr0iry+TAeaDrYucmahZvI1Pmrfer3D6DMCbBwHvo8b rq8cCj7a7yl2lKayqhIun7n+jeraTLEBb9MYweOcI8OoKFjoSK/VmzClcqogB976x7Ga LbMKUy2m5iphwB1DnHYRpnvxTFm7gc7vBD6AwKnhPHroTcRcnE8eQoRWQXhBGXOyxS35 NJzWr2+TxtTvuxIXV5VeQmUITw/PmGQvV1S1WcYSxmlbdn6ZMB0kti5Ylrs/7RfUEVJX fbeKZr8f4xCDX5aoP2imiakTwtH1VSocldviVQTBBvGfkEpNWHymT5XK5AKMxP2B6WrO bQ2Q== X-Gm-Message-State: AHPjjUg5MlpOaI7+EHZkt3KBQZ6hbkUQ+98KW7/fWmC64HV6iboL5JpM lagse10hk1f2mlA9jmowcvk= X-Google-Smtp-Source: AOwi7QB9SA79MHvgBiMorZzsEA2OBUlzWPaI0l7QmYlyQhNB9GjDtzs2SHhbyrDWxzcMSp4FjF3CUw== X-Received: by 10.223.159.77 with SMTP id f13mr3780251wrg.154.1505892370506; Wed, 20 Sep 2017 00:26:10 -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 4sm995012wmg.20.2017.09.20.00.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 00:26:09 -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 v2] dmaengine: sun6i: use of_device_get_match_data Date: Wed, 20 Sep 2017 09:24:02 +0200 Message-Id: <20170920072402.27704-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-20170920_002632_623444_E6279EB2 X-CRM114-Status: GOOD ( 10.95 ) 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. Acked-by: Maxime Ripard Signed-off-by: Corentin Labbe --- Changes since v1: - fixed commit title 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);