Received: by 10.192.165.148 with SMTP id m20csp2598528imm; Sun, 22 Apr 2018 10:29:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx48zc+6w+HqM5GqpS82+Zx4+++fi2bglAxFYhi4ESociO+aJxR14FWoByZ7oBPEr2gO/5Xr4 X-Received: by 10.98.68.135 with SMTP id m7mr17094726pfi.57.1524418172522; Sun, 22 Apr 2018 10:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524418172; cv=none; d=google.com; s=arc-20160816; b=yYFPDUMcXbQ0JmKlmudUtG7mDz2ixwjcBP0knaAhdsegKpyfTQddf0uxnm5A9q/O6H eK3Znp0R9nru7On3qGyJPKy4PrpsP0cmciQc3DqMoHNdjf7Okx+f1rIdWMeNuEvM/BZx Klgl4kttLLi8M3IgVIFOqSUkJPlzMtxrIvgyF2VBgUXPg7lAzWFjRIc644ztmcUiO0zN 9jDRNADKPLMGMuuG5oQ4lpfds23GVdEBQ+2r7m9QoTbIipzV2gOhNdfubFIZr9WBm0t3 Ga1zrdAXjiIEg6Mtj2+bLT8BwWylD2/eLDzRuQp6PdhSziRGiiZSUKSzvJnP0jUTyX6O mUeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=1JWXCtlPDwUnVnCr0fptODljfSpu1qZoEBgU98JhCy4=; b=vu7apw5fIwu0m6T0WgwuiNx/9z8NRygIQn1cQhEGHsb7sPpgOR7xsNaMty06Y29hb0 6gvd6wu3LqJQpIGXN1RFULAYxuRIx1GaHGxNr9eRgS0YWV5OEj+9a469VXrDccC6hEnn fwhVP1gqbrQRssv2guYGyQ2FCT4ttdOx48jV+KWjygD1YHZ3isdAQN26g6BmMDLcXzU+ u9+bKbjS2oeKkcijFoFiH9rUw+agvlOkAd9Ynwo6R6/sKAWto26cspkPW2el6cdD9Y+k z1vqEDFIcVvHA9tyoM7ycADkj4Wy/hLXJ4alR9ykqOJhAWqD8JJAC/mJlnWEIXTJ7HM6 UffQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si10006530pli.354.2018.04.22.10.29.18; Sun, 22 Apr 2018 10:29:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbeDVR2E (ORCPT + 99 others); Sun, 22 Apr 2018 13:28:04 -0400 Received: from mail.bootlin.com ([62.4.15.54]:46693 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752545AbeDVR2A (ORCPT ); Sun, 22 Apr 2018 13:28:00 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 22845207D2; Sun, 22 Apr 2018 19:27:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [195.53.49.241]) by mail.bootlin.com (Postfix) with ESMTPSA id B6C55207C2; Sun, 22 Apr 2018 19:27:48 +0200 (CEST) Date: Sun, 22 Apr 2018 19:27:48 +0200 From: Boris Brezillon To: Ryder Lee Cc: Boris Brezillon , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-mtd@lists.infradead.org, Xiaolei Li , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data() Message-ID: <20180422192748.42fc6b6f@bbrezillon> In-Reply-To: References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Apr 2018 10:33:54 +0800 Ryder Lee wrote: > The usage of of_device_get_match_data() reduce the code size a bit. > > Also, the only way to call .probe() is to match an entry in > .of_match_table[], so of_device_id cannot be NULL. > > Signed-off-by: Ryder Lee > --- > drivers/mtd/nand/raw/mtk_ecc.c | 7 +------ > drivers/mtd/nand/raw/mtk_nand.c | 10 +--------- Applied to nand/next after fixing the subject prefix. Thanks, Boris > 2 files changed, 2 insertions(+), 15 deletions(-) > > diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c > index 40d86a8..6432bd7 100644 > --- a/drivers/mtd/nand/raw/mtk_ecc.c > +++ b/drivers/mtd/nand/raw/mtk_ecc.c > @@ -500,7 +500,6 @@ static int mtk_ecc_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct mtk_ecc *ecc; > struct resource *res; > - const struct of_device_id *of_ecc_id = NULL; > u32 max_eccdata_size; > int irq, ret; > > @@ -508,11 +507,7 @@ static int mtk_ecc_probe(struct platform_device *pdev) > if (!ecc) > return -ENOMEM; > > - of_ecc_id = of_match_device(mtk_ecc_dt_match, &pdev->dev); > - if (!of_ecc_id) > - return -ENODEV; > - > - ecc->caps = of_ecc_id->data; > + ecc->caps = of_device_get_match_data(dev); > > max_eccdata_size = ecc->caps->num_ecc_strength - 1; > max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size]; > diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c > index 6977da3..75c845a 100644 > --- a/drivers/mtd/nand/raw/mtk_nand.c > +++ b/drivers/mtd/nand/raw/mtk_nand.c > @@ -1434,7 +1434,6 @@ static int mtk_nfc_probe(struct platform_device *pdev) > struct device_node *np = dev->of_node; > struct mtk_nfc *nfc; > struct resource *res; > - const struct of_device_id *of_nfc_id = NULL; > int ret, irq; > > nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); > @@ -1452,6 +1451,7 @@ static int mtk_nfc_probe(struct platform_device *pdev) > else if (!nfc->ecc) > return -ENODEV; > > + nfc->caps = of_device_get_match_data(dev); > nfc->dev = dev; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > @@ -1498,14 +1498,6 @@ static int mtk_nfc_probe(struct platform_device *pdev) > goto clk_disable; > } > > - of_nfc_id = of_match_device(mtk_nfc_id_table, &pdev->dev); > - if (!of_nfc_id) { > - ret = -ENODEV; > - goto clk_disable; > - } > - > - nfc->caps = of_nfc_id->data; > - > platform_set_drvdata(pdev, nfc); > > ret = mtk_nfc_nand_chips_init(dev, nfc);