Received: by 10.192.165.156 with SMTP id m28csp152880imm; Sun, 15 Apr 2018 19:35:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx49entqva+Q1cZXIt5B4L9YUl5Tq3OzvlgwcXOgBGFYpdnIgYQUT/sTDv1TLuLaU6MTF+biQ X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr13857630pls.109.1523846118845; Sun, 15 Apr 2018 19:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523846118; cv=none; d=google.com; s=arc-20160816; b=i6R6Vg2pPkapJQ3Y8fzfj9UTHC4S1gD1hY/KiHLHJFGfulqXR/yqCbuHWPoo+sHq0x XEAqcUKt3B830nIbMo0vUagVfF9QkcQ4Q74Z7X3s02x0KBiExOQrr8XjVHv3PETTVx2D Qlk+6mDORm/ycwVZ0rJj6Ad9fiL2BWzJA/Bx5B6OVLDQ2m54ea/Zgm0oS2Ia8Atj8s4a NNNv7RPQNTVIlA3OG5fZC21wIIXwEB5UWapBKPpJN0FoT/wFXvuC7hTjTf7ae1YgYpF5 c1rJsIGVgjniKQJHwUUuSMcQLkfdKnUBBumUgxM79fP4x1l927Kvri4DmLWS/jheoABo BHLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=7UhixMhAHjAsD6J8w563I1ZktDQnHutn6imetwoIzs0=; b=wlsqiUN9+SZOuxIyDw0MpL6wjxDNvrDIKbZqfffeKYhaVJUduApikmtHurQZwwMsTD ReXrs+zODfNBo44XK0+thz2jlvJY24t5ACVlA+AzyHvOZ8qAACVikTDt25zh83+HB6aC FVN/6qDFvCjEkA2ATU69n3/uu4BIg/6i/pmGH/k13Rmzw671IldPW6OYuSLLl7+Kp/AS sYxqzM4doAmEsmmZoBGhp8aW6kymXjJOuRfwUPt7YXVVYAT5CA8g2EoNXrSfrYRbaUlI IDMy4Is5VkWkFOUnINkPXzdMXssKYInJ/I5JaPHqe3huQI/ukdNX0g2JzJ3kLcRxLq21 ynBw== 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 f90-v6si11049814plf.496.2018.04.15.19.35.04; Sun, 15 Apr 2018 19:35:18 -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 S1753124AbeDPCdN (ORCPT + 99 others); Sun, 15 Apr 2018 22:33:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:12487 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753099AbeDPCdM (ORCPT ); Sun, 15 Apr 2018 22:33:12 -0400 X-UUID: a0a4f853752742158f1bcb187882d0da-20180416 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1479102764; Mon, 16 Apr 2018 10:33:08 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 16 Apr 2018 10:33:07 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 16 Apr 2018 10:33:06 +0800 From: Ryder Lee To: Mark Brown CC: Leilk Liu , , , , , Ryder Lee Subject: [PATCH] spi: mediatek: Use of_device_get_match_data() Date: Mon, 16 Apr 2018 10:33:00 +0800 Message-ID: <94cba80f703be048666afde1ed53c15c3704c533.1523347340.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The usage of of_device_get_match_data() reduce the code size a bit. Also, the only way to call mtk_spi_probe() is to match an entry in mtk_spi_of_match[], so of_id cannot be NULL. Signed-off-by: Ryder Lee --- drivers/spi/spi-mt65xx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index 86bf456..3edc183 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -578,7 +579,6 @@ static int mtk_spi_probe(struct platform_device *pdev) { struct spi_master *master; struct mtk_spi *mdata; - const struct of_device_id *of_id; struct resource *res; int i, irq, ret; @@ -598,15 +598,9 @@ static int mtk_spi_probe(struct platform_device *pdev) master->can_dma = mtk_spi_can_dma; master->setup = mtk_spi_setup; - of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node); - if (!of_id) { - dev_err(&pdev->dev, "failed to probe of_node\n"); - ret = -EINVAL; - goto err_put_master; - } - mdata = spi_master_get_devdata(master); - mdata->dev_comp = of_id->data; + mdata->dev_comp = of_device_get_match_data(&pdev->dev); + if (mdata->dev_comp->must_tx) master->flags = SPI_MASTER_MUST_TX; -- 1.9.1