Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp481860pxu; Thu, 3 Dec 2020 05:25:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVrw7i80TwMJ+i4MFjpIv4+saw4yoqmDi6jVpyk5UQFK/T4WQWElyzJzZ3Wsge5kuejexb X-Received: by 2002:a50:a6c9:: with SMTP id f9mr2806356edc.158.1607001952179; Thu, 03 Dec 2020 05:25:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607001952; cv=none; d=google.com; s=arc-20160816; b=RV3+Mrri5C/I2IsUbfeZkUAqw1qQmZbsII3q9Y2utEewtJhzzVRKZg1jGkOhwsZxup /ZRnUk1BS3R4eKr91LZI6PCnvcM3lVwf+2574fiPUBmJuPwUQsb8gUlhLWoMK21KYNOO qNw7hn5SAKcC01ykucESBbEbMJHvzCLbmmB+wpBLdwLjwf30NsF4r1/AVHRqo6MJ7HDo TgV9zoBnXdKuurv+BqKn1ngLKMPXsO2917INUcq5xmFBgLs/A+1sixYYlOKcbhnn3Rvb nZP6I1VnIAlHW2zTyYdINiAgNX+jSgP2LsgRJMSqc84DMNUMVd8eQ+vYcAudayk6Fx7X oHag== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=xr6ubetRcdw3MknkwI3+tg6m/AwRRq+QdjB3wYZxUt8=; b=XMb3rwuXXsuFYpJG6PK6BAm2ews51VYhq9wLtrcYDttfjSsSXg6L/WRPrLpodcMoYF LgoX8Mdi2tUolYusoi/MhXwSc161BcQCjeTFuqSJay2QEgIFe7agTQJHW6cAdCOeGQJT 76l/QUJwQf9RQFbFtfgTkKG7fvPUHWEDHr2RWbkWEgGpSpBd3azLDL0FJdx80Bc4KOOR z2efrRrLCExPtDqmll916OvOxKi0zmcfqE0trrt8sN8fzZ2u5TY16k3m2EYVHAJXRD6T 3fUvwu1sS8DOIxb0IDqCACLBiLdZez+B7IGVvZvUCV8PDMbUv37QC0G4nBNMzfVArYKQ G/pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JEjFX2xF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si1061957eja.497.2020.12.03.05.25.28; Thu, 03 Dec 2020 05:25:52 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JEjFX2xF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388554AbgLCNXX (ORCPT + 99 others); Thu, 3 Dec 2020 08:23:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49399 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730608AbgLCNXX (ORCPT ); Thu, 3 Dec 2020 08:23:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607001717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xr6ubetRcdw3MknkwI3+tg6m/AwRRq+QdjB3wYZxUt8=; b=JEjFX2xF4yCXRxTuV9kFRJZhHXIufbaRtHbxRU+FWLMjaU9eDt/OPK2sLZm++3kIJQUq6a bfdBGf7vdp33TkqQ7mcdtlzO//+1w+pveT2ZkZsF3IKCgZmaXDJnjtcRUDAKeAqnk3GVfv tPQsX2O7GU9p6cDpylXvssqXpUzfQts= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-119-ivUdRog-NqWVMt9wROXWjg-1; Thu, 03 Dec 2020 08:21:53 -0500 X-MC-Unique: ivUdRog-NqWVMt9wROXWjg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4FDC100F350; Thu, 3 Dec 2020 13:21:51 +0000 (UTC) Received: from gondolin (ovpn-113-106.ams2.redhat.com [10.36.113.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id F17035C1BD; Thu, 3 Dec 2020 13:21:42 +0000 (UTC) Date: Thu, 3 Dec 2020 14:21:40 +0100 From: Cornelia Huck To: Andy Shevchenko Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Eric Auger , Alex Williamson , kvm@vger.kernel.org, linux-usb@vger.kernel.org, Peng Hao , Arnd Bergmann Subject: Re: [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Message-ID: <20201203142140.73a0c5e6.cohuck@redhat.com> In-Reply-To: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> References: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Oct 2020 19:58:02 +0200 Andy Shevchenko wrote: > There are at least few existing users of the proposed API which > retrieves either MEM or IO resource from platform device. > > Make it common to utilize in the existing and new users. > > Signed-off-by: Andy Shevchenko > Cc: Eric Auger > Cc: Alex Williamson > Cc: Cornelia Huck > Cc: kvm@vger.kernel.org > Cc: linux-usb@vger.kernel.org > Cc: Peng Hao > Cc: Arnd Bergmann > --- > include/linux/platform_device.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h > index 77a2aada106d..eb8d74744e29 100644 > --- a/include/linux/platform_device.h > +++ b/include/linux/platform_device.h > @@ -52,6 +52,19 @@ extern struct device platform_bus; > > extern struct resource *platform_get_resource(struct platform_device *, > unsigned int, unsigned int); > +static inline > +struct resource *platform_get_mem_or_io_resource(struct platform_device *pdev, Minor nit: If I would want to break up the long line, I'd use static inline struct resource * platform_get_mem_or_io_resource(...) > + unsigned int num) > +{ > + struct resource *res; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, num); > + if (res) > + return res; > + > + return platform_get_resource(pdev, IORESOURCE_IO, num); > +} > + > extern struct device * > platform_find_device_by_driver(struct device *start, > const struct device_driver *drv); Reviewed-by: Cornelia Huck