From patchwork Mon Feb 14 08:09:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jammy Huang X-Patchwork-Id: 12745086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E942C433FE for ; Mon, 14 Feb 2022 08:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yOm2lxyWfKpR3utqsOzNJhgmNvHsyj3qu3z62YoJc3s=; b=k8/ibS5+Q+hiGi /U/90eaHb63ovtwhyJT33DDD4s8DVnzYJJHFjIm9VkTZM6n9Bc3Nhqqmei2duLW6hviEcvYrNq/Qj mEFBmbONdjWkju8tBGF4l7POM69LEKBFawrXbhQafNecWszR1pLDv0h+fF0P8/nNT9/BgAPcdTvI/ jYryE3sh3nFzkXZLwR1WHNwE3LRmBB6USN+ZuiIeGeE+pVSKN4LoSyZsdmKf5g8XfTo8epfR+EI1m jv4embGfYrQs0kg+bG0+gCaN82fDT4MpRdxnAVlYB0w4dipav2DhIk3JUC8gNDB+buPh0WdAMzsGt 3ZjQO4KFyw/lz97bfn3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJWQv-00Do64-RE; Mon, 14 Feb 2022 08:10:05 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJWQu-00Do5f-EU for linux-arm-kernel@bombadil.infradead.org; Mon, 14 Feb 2022 08:10:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:In-Reply-To:References; bh=NttRj4qeczv2CsNcuuTmtryv5RAOPF6CCZJJw9jMHvw=; b=QsVi89Yx6+EBYVg5kybk6mjnb5 KjcKd+V++WO0SckeKYVljE4EpGry4btNCOIdmAAcSIyxNhPtCNOd9P0r+wVEC12AUIJdrkYMyy34F sBmsnyTov9f/wKMFvNVURN9r+Hcq6FC/TyXKTd4Q4HVY+gYS6VrTOAdBiyNlMXcsLVsPk4TmmSN28 rSjmxXRzoU0R0r9KApWIl/RbS36r19NC0iMa5fT4VQIKZBh2H5dMSPI/KPOT5W2WfADhsR6rDbLJp syqqVvYHS2NDmSPsuC3BJzDYmDeGoj+9jztcOgjoebq/uFAg3jrYYuQhUsmQqyYs9KZ4uEVVcL20j TDgmWQDQ==; Received: from twspam01.aspeedtech.com ([211.20.114.71]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJWQp-009rc6-Tc for linux-arm-kernel@lists.infradead.org; Mon, 14 Feb 2022 08:10:02 +0000 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220214_081000_523951_E6411095 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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;