Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2659079pxb; Mon, 17 Jan 2022 03:08:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5Ses12txiIIRIycJ+zWUGKZ7uBhEK4U2b5yOeu3I5VNK3thvNOyJcbtHSzjkyxXh9eJJZ X-Received: by 2002:a65:5c87:: with SMTP id a7mr19019095pgt.600.1642417693367; Mon, 17 Jan 2022 03:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642417693; cv=none; d=google.com; s=arc-20160816; b=eL5jfol5RNGLKExu610a7lQL2VQkLpoM15TcsSuCx41I64t2ZluytDVHYX5vSCBVnb uDlJ9BngFWlwntp7YH6Mq+I6taq6Npngf2JHXY2ssR9vC4Fgjh1nguIrtVzIcLcEDdrG TDpUeNjpVNOP/snfjlcAqwk3exn9YL6mUgJbiADcmnvYRFIzIbwBK58NC+dcE02W8qhP Z0A1uNwZMoqdWbtRmHtctU29n6/zDEvudbUQy2ccaHunH/53uNBOpFMk+13/2kWfTD7s 9X/On50pwwP+cE0ZXQL7LxDmAAbJRqOH2pl7LB3UVtUpDHYcOc3XgwNEX0vEEcMmbE6G fHeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=82IGDS+EISE7fv4gqCuxFuUf4/wzwCPE/Fq5EjKk6v4=; b=zcNbVuz0TH85rTswqd37VfErP55hw2EERjQfVsPKeE7WW7juT8C9zs9mRsIJKlU1pM XcNAFfzk2u2HwtnR8OIVM90tdVjET5W2XbPXTCSLSaQkVZUl6JPW9Z47f62zQXytQcOl IjNjA7Jyti9cEi8ECEEH3gPkZCeMIzocPuHEnNIz10gct7V4hMvyYWXkm5gQkfmNIAY/ JBnusK0Z9ufhNfQWEqNb9+Cz9zpNRHB+DZ5D4BYW5YZ2uLuLVwZX8rGvhDGkrKZ7Bqef DygwDHQnLlMtvZw9P/MezQtRrQmh5K10Ta+JLtQpkynDPmC+8b445ABQVEy+n4PkGT1I 3fUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mu6si6658552pjb.65.2022.01.17.03.08.00; Mon, 17 Jan 2022 03:08:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236752AbiAQCCH (ORCPT + 99 others); Sun, 16 Jan 2022 21:02:07 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:59352 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236739AbiAQCCG (ORCPT ); Sun, 16 Jan 2022 21:02:06 -0500 X-IronPort-AV: E=Sophos;i="5.88,294,1635174000"; d="scan'208";a="107257767" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 17 Jan 2022 11:02:04 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 2CEB8400855F; Mon, 17 Jan 2022 11:02:03 +0900 (JST) From: Lad Prabhakar To: Damien Le Moal , linux-ide@vger.kernel.org Cc: Sergey Shtylyov , linux-kernel@vger.kernel.org, Prabhakar , Lad Prabhakar Subject: [PATCH] ata: pata_platform: Make use of platform_get_mem_or_io() Date: Mon, 17 Jan 2022 02:01:34 +0000 Message-Id: <20220117020134.3279-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make use of platform_get_mem_or_io() to simplify the code. While at it, drop use of unlikely() from pata_platform_probe() as it isn't a hotpath. Signed-off-by: Lad Prabhakar Reviewed-by: Sergey Shtylyov --- Hi All, This patch is part of series [1]. Just sending this lone patch for now. [1] http://patchwork.ozlabs.org/project/linux-ide/list/?series=278349 Cheers, Prabhakar --- drivers/ata/pata_platform.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 028329428b75..29902001e223 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c @@ -198,22 +198,16 @@ static int pata_platform_probe(struct platform_device *pdev) /* * Get the I/O base first */ - io_res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (io_res == NULL) { - io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (unlikely(io_res == NULL)) - return -EINVAL; - } + io_res = platform_get_mem_or_io(pdev, 0); + if (!io_res) + return -EINVAL; /* * Then the CTL base */ - ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1); - if (ctl_res == NULL) { - ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (unlikely(ctl_res == NULL)) - return -EINVAL; - } + ctl_res = platform_get_mem_or_io(pdev, 1); + if (!ctl_res) + return -EINVAL; /* * And the IRQ -- 2.17.1