Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp129810imu; Thu, 3 Jan 2019 15:41:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN6kzgmrxTmO5ykl2Pqx0lF9SRV5lycwYYQhKGv5UXiNEZvrabu3nqnukTDycM8dx0zOMzfD X-Received: by 2002:a63:4246:: with SMTP id p67mr18526406pga.335.1546558885333; Thu, 03 Jan 2019 15:41:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546558885; cv=none; d=google.com; s=arc-20160816; b=YCR7c8tUFX4BR3ezjN23PQyQ3BnvacFxYPiyTiYDdzPa0y5HH25DEbEc4oRRPdUV7g QZvbbObyzytlysn6bg55vDEB/eluPyY5IZ0W8TlHhER5tmSRGr8zQu0SAq2ZJTVkObtb 1zXnECciLi5RbbSifCwu74Bo+ejB1vN9VWZ6/LlTYqPlNk1IrM2V86ouOMedCM3eI2jU flUd4U038L3iWzkJO3OrriPwXF4wZsfReC8e8jhAV7JZjwzC9aUoW0gscK0fW4COPhid FNciKyf3XN8YFTtYo8rc2BKykuQYBwCsmAF330EyZ99Elq7j7wQ1pawlH2GI2dJy53MY FD5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yDz7QBjISpr2/aHFIwizHIIDXcaqwxB6hC8+SZOWP/0=; b=qUjNJ0+w2Xq5chnfCnZ0xb1CJtpFxEuzgag4va0TzW3uClvLA0tF4VreH3ZvCeDNAa UOIEA60nEwlcFRuQodLJmtsof6OEbmI2QaeYXPeSX0WU+FqdVfI6ERGdl661D9CqUPqv XDy4xzMPX9Aw2aFW9kD6Yl6J4H8+siTmxqxSh5EI7lXIlYollieoiiSQX6Vb1QIbsvrj h4Od3XiTDUAqmJJrrtahBbCqGxdRPTdm5srAOCCZjDSbESvZ3X6x6W3AxEnY32CqPdLc amtaVGtHr8B509HzdsVtRpbjDf9gNZ5K2+5TFrfJPqaN2vN13gDBDkHWdLxAlzt6MnbL rgNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Cjzrpj/S"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 187si210487pfb.41.2019.01.03.15.41.10; Thu, 03 Jan 2019 15:41:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Cjzrpj/S"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731916AbfACRwG (ORCPT + 99 others); Thu, 3 Jan 2019 12:52:06 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33486 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728424AbfACRwG (ORCPT ); Thu, 3 Jan 2019 12:52:06 -0500 Received: by mail-pf1-f193.google.com with SMTP id c123so17019747pfb.0 for ; Thu, 03 Jan 2019 09:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yDz7QBjISpr2/aHFIwizHIIDXcaqwxB6hC8+SZOWP/0=; b=Cjzrpj/SYRCh77oTd6unz6v1o1fRXQfyDrIOTXXGHsRmNKEDp/hUYK8KVi1Xq9FC39 PIfEDvMIJAxFdvKxHuGifLOTwmKCoKkGpeuW+NGac5CXAZSwxvZM80PB1aU0N0YlAafI 1YU/HZVAy60g4jA/JEaJVh5vxXcLjEPfUVnjdPm7rINY1F5uvVookWMW+DcyWjEjKZj9 NRjttIeig7ENxJwrYjN0Ge3qlMoZ/WRW5cPCIxRmhQZ22YfjHvErrSb2UpxmcVFenJfj OnbMdh8AcotpfI4NwHK88hA16PXY08AN88x8nhBtx9iefwc3Ll5YU5+ElGQ3qzudL65C bx9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yDz7QBjISpr2/aHFIwizHIIDXcaqwxB6hC8+SZOWP/0=; b=THT6cKD2iVz8CiffBVQqJTFNLh2gwbaNjC+S78eh72yQtCBKnnwMf/KWDwybfvqxyQ QEojyNCkl/T8/PcrOX81nyVoRyLds4prjaqpgGBL/mPr/lylUEEP5C96nhNtK6zdF2hI 0RGRFqMHWhmu3aiSjlz6UAxDdZN6L5K0jC1KehT+3M3xP6BbO7LG0vdSz/lV4pVTDBZi PSZ1AZSHIsaC0QwLfbZdxd3GH9V/YBUaVxNppwSD/dge/eVrZF/TWOanakM8Jpvw9FDm J1apWCKZrZPpsQOcdRHeiFMdMeO3G0ctOk7b/mXyIlnzqjJU9iDw8C5bL2as1LfspxkI 17Ig== X-Gm-Message-State: AJcUukfhoO67dK9XKOwnDDTAwaBXvPR5jJ4l2FLRD21xBFmBss01bPkQ 7R7ilBTHXQvVtUx0n1OX/S72NORG8/yL7DSAl9RHEu1i X-Received: by 2002:a63:fe0a:: with SMTP id p10mr17680040pgh.265.1546537925039; Thu, 03 Jan 2019 09:52:05 -0800 (PST) MIME-Version: 1.0 References: <20190102185106.56913-1-swboyd@chromium.org> In-Reply-To: <20190102185106.56913-1-swboyd@chromium.org> From: Andy Shevchenko Date: Thu, 3 Jan 2019 19:51:53 +0200 Message-ID: Subject: Re: [PATCH v3] driver core: platform: Add an error message to platform_get_irq*() To: Stephen Boyd Cc: Rob Herring , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Mark Brown , Greg Kroah-Hartman , Javier Martinez Canillas , linux-arm Mailing List , Linux Kernel Mailing List , Russell King - ARM Linux , Marek Szyprowski , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 2, 2019 at 8:51 PM Stephen Boyd wrote: > > A grep of the kernel shows that many drivers print an error message if > they fail to get the irq they're looking for. Furthermore, those drivers > all decide to print the device name, or not, and the irq they were > requesting, or not, etc. Let's consolidate all these error messages into > the API itself, allowing us to get rid of the error messages in each > driver. > Thanks, Reviewed-by: Andy Shevchenko > Signed-off-by: Stephen Boyd > --- > > Changes from v2: > * Don't refactor platform_get_irq(), just wrap it > > Changes from v1: > * Update error text to indicate irq index instead of IRQn, use %u > > drivers/base/platform.c | 31 +++++++++++++++++++++++-------- > 1 file changed, 23 insertions(+), 8 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 1c958eb33ef4..388461306dd4 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -79,12 +79,7 @@ struct resource *platform_get_resource(struct platform_device *dev, > } > EXPORT_SYMBOL_GPL(platform_get_resource); > > -/** > - * platform_get_irq - get an IRQ for a device > - * @dev: platform device > - * @num: IRQ number index > - */ > -int platform_get_irq(struct platform_device *dev, unsigned int num) > +static int __platform_get_irq(struct platform_device *dev, unsigned int num) > { > #ifdef CONFIG_SPARC > /* sparc does not have irqs represented as IORESOURCE_IRQ resources */ > @@ -130,6 +125,22 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) > return r ? r->start : -ENXIO; > #endif > } > + > +/** > + * platform_get_irq - get an IRQ for a device > + * @dev: platform device > + * @num: IRQ number index > + */ > +int platform_get_irq(struct platform_device *dev, unsigned int num) > +{ > + int ret; > + > + ret = __platform_get_irq(dev, num); > + if (ret < 0 && ret != -EPROBE_DEFER) > + dev_err(&dev->dev, "IRQ index %u not found\n", num); > + > + return ret; > +} > EXPORT_SYMBOL_GPL(platform_get_irq); > > /** > @@ -142,7 +153,7 @@ int platform_irq_count(struct platform_device *dev) > { > int ret, nr = 0; > > - while ((ret = platform_get_irq(dev, nr)) >= 0) > + while ((ret = __platform_get_irq(dev, nr)) >= 0) > nr++; > > if (ret == -EPROBE_DEFER) > @@ -195,7 +206,11 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) > } > > r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); > - return r ? r->start : -ENXIO; > + if (r) > + return r->start; > + > + dev_err(&dev->dev, "IRQ %s not found\n", name); > + return -ENXIO; > } > EXPORT_SYMBOL_GPL(platform_get_irq_byname); > > -- > Sent by a computer through tubes > -- With Best Regards, Andy Shevchenko