From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751865AbeDSNS7 (ORCPT ); Thu, 19 Apr 2018 09:18:59 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:34094 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbeDSNS6 (ORCPT ); Thu, 19 Apr 2018 09:18:58 -0400 X-Google-Smtp-Source: AIpwx4/oOfjPUAC9bd58x7upGSEcBDxteUDLUE0jVsCwsy3SIBxlv9sDsgBuzAa1BM6e6uZ9OqRzoW56ljNLCyTZwyg= MIME-Version: 1.0 In-Reply-To: References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> From: Ulf Hansson Date: Thu, 19 Apr 2018 15:18:57 +0200 Message-ID: Subject: Re: [PATCH] mmc: mediatek: use of_device_get_match_data() To: Ryder Lee Cc: Chaotian Jing , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Linux ARM , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16 April 2018 at 04:33, Ryder Lee wrote: > The usage of of_device_get_match_data() reduce the code size a bit. > > Also, the only way to call msdc_drv_probe() is to match an entry in > msdc_of_ids[], so of_id cannot be NULL. > > Signed-off-by: Ryder Lee Thanks, applied for next! Kind regards Uffe > --- > drivers/mmc/host/mtk-sd.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c > index 6457a7d..67e9b57 100644 > --- a/drivers/mmc/host/mtk-sd.c > +++ b/drivers/mmc/host/mtk-sd.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1808,7 +1809,6 @@ static int msdc_drv_probe(struct platform_device *pdev) > struct mmc_host *mmc; > struct msdc_host *host; > struct resource *res; > - const struct of_device_id *of_id; > int ret; > > if (!pdev->dev.of_node) { > @@ -1816,9 +1816,6 @@ static int msdc_drv_probe(struct platform_device *pdev) > return -EINVAL; > } > > - of_id = of_match_node(msdc_of_ids, pdev->dev.of_node); > - if (!of_id) > - return -EINVAL; > /* Allocate MMC host for this device */ > mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); > if (!mmc) > @@ -1887,7 +1884,7 @@ static int msdc_drv_probe(struct platform_device *pdev) > msdc_of_property_parse(pdev, host); > > host->dev = &pdev->dev; > - host->dev_comp = of_id->data; > + host->dev_comp = of_device_get_match_data(&pdev->dev); > host->mmc = mmc; > host->src_clk_freq = clk_get_rate(host->src_clk); > /* Set host parameters to mmc */ > -- > 1.9.1 >