Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5962818pxb; Mon, 14 Feb 2022 11:48:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHzSImYalDHWsbFGv3jM9Hu5NjTy0UAVZAn8MDpLcrSd6NNlJA6O61vVYButDmWXgn7G1J X-Received: by 2002:a17:90b:3508:b0:1b9:92fb:239d with SMTP id ls8-20020a17090b350800b001b992fb239dmr255097pjb.224.1644868115830; Mon, 14 Feb 2022 11:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644868115; cv=none; d=google.com; s=arc-20160816; b=gpF9CxfF0QvfbJ8bDNX109xE6Pck4c73npkp5/Uov4fXypOF/hwoaQ2coaIc8atSGg J6g9DnCICH7LUIBjObxmdQ+NtbtIvwi3CRIiZxl9qm4UBNKw3CBsGTIz6X0MpJSJc+ks xDyKyTzXLmobylzuQXV957PztM3B4d5SX+3pi9sQTKVZ6ewJmg2BJa47TKzEgVj/JPlP QlRq79UwTyfsTCshqdOYWtRLT8r9iKWjYyyQFy36sB57uwJi2bcuGDVNW45vLn7agEZm MwwaTHkRpyJrWIvG7VUFHkwU2wQK+jFZTrcp65IqNw91pxBbunPeoccVBAdYlhENFB7l 3aVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=NttRj4qeczv2CsNcuuTmtryv5RAOPF6CCZJJw9jMHvw=; b=UZM2gyy5aBWAAbpDUlWifb87B2fg0JqXuVFFb1iRkQDK+vqK78b4ysZ0/WadfMSTBh 4gXE8XB/19Pcm4DGpSe8m+T1BuLzpt2hfqPo7EBbi1uHz0gXX/W6iiPR74yC/amfUZ11 5hh7LI+19X9OENt5ET+l+5Bx/2cw6fLhLBYl654hzYyRjguzT3QgT2mb4YwXxTQJ8rDS bcC44JS0A+rpC3bZhIvIN13nEtaDkmZ1AzUdMJxOwslcW2fC97xzhQTw+4XSjhR6v9H7 9o4wka0RjfIL7Wmc56vkzWGFAxlVC51z3EFugMFC+HHPhEiS1DDD1VV82L4RNJPBtXsI g63w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s7si34532105pfu.268.2022.02.14.11.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:48:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91C0CD886A; Mon, 14 Feb 2022 11:31:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241594AbiBNIJu (ORCPT + 99 others); Mon, 14 Feb 2022 03:09:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241589AbiBNIJt (ORCPT ); Mon, 14 Feb 2022 03:09:49 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D3C95F8E6 for ; Mon, 14 Feb 2022 00:09:41 -0800 (PST) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 21E81BqX064667; Mon, 14 Feb 2022 16:01:11 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 14 Feb 2022 16:09:38 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v2] media: aspeed: Use of_device_get_match_data() helper Date: Mon, 14 Feb 2022 16:09:09 +0800 Message-ID: <20220214080909.2792-1-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 21E81BqX064667 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use of_device_get_match_data() to simplify the code. Signed-off-by: Jammy Huang --- v2: - Add a check for null pointer for of_device_get_match_data --- drivers/media/platform/aspeed-video.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index 3904ded2052a..91ec7eec1e6e 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -2451,7 +2452,6 @@ MODULE_DEVICE_TABLE(of, aspeed_video_of_match); static int aspeed_video_probe(struct platform_device *pdev) { const struct aspeed_video_config *config; - const struct of_device_id *match; struct aspeed_video *video; int rc; @@ -2463,11 +2463,10 @@ static int aspeed_video_probe(struct platform_device *pdev) if (IS_ERR(video->base)) return PTR_ERR(video->base); - match = of_match_node(aspeed_video_of_match, pdev->dev.of_node); - if (!match) - return -EINVAL; + config = of_device_get_match_data(&pdev->dev); + if (!config) + return -ENODEV; - config = match->data; video->version = config->version; video->jpeg_mode = config->jpeg_mode; video->comp_size_read = config->comp_size_read; -- 2.25.1