From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 115A3C64E7A for ; Thu, 3 Dec 2020 13:23:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF7DF20753 for ; Thu, 3 Dec 2020 13:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388863AbgLCNXX (ORCPT ); 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