Message ID | 20230116184707.22302-1-bpappas@pappasbrent.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1351882wrn; Mon, 16 Jan 2023 11:02:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRIkqcsvzCtqnrWOukvJvJab83OxuwPdI8suDeopKqR4/xZkBP1BKiP1T6ptowXZoQXsNk X-Received: by 2002:a17:907:1248:b0:84d:45db:b203 with SMTP id wc8-20020a170907124800b0084d45dbb203mr74611ejb.12.1673895722796; Mon, 16 Jan 2023 11:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673895722; cv=none; d=google.com; s=arc-20160816; b=bmflE056sCkPBP8Nw+HDiInaTljq0ZfftQ8aXaKBo6F0jVuGFW55BSV72RcHegVfiB EYHNIZxTH37xiKGlHb2tcNIypA90cUcQWFlQbVh786JEsJHf2+riMZiYhAqIn2hFEN5U 0a+CqpHWJckzq4rEz52hHbWExQtOALd8Uu2aPLYvhCSYwNx9y0uFbXX9SM8/aaXokqcK r71i7qgflBSNduSi3TI4e1ZBRdr/9W/p9AFYSwWAEYz3+J07hROzRZ55uM32mRAHVuOd E5d8zlIbVpDgZAyq1X0zRLHsZ9voHmfQLoXWe/5CuoK8pMzevkYvMfiJcRpySU+W3SxV efXg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xlTqzW0yJfVwEa1dVeJlSqR/6z1G/kF1OYTItRVzH2c=; b=X5EofsQiPBTDJSWPpv+BfLlI5SFWedvCi/Yyq3PJjdqnec1jpntp6oUdtrKlzvrk1r hFtqj99BHQxWoA8URkYEnu/lrkBaBcKVDZA77PUA4BKhFdBbj8kRYE5hUXfVht3kdSyy 0HHGdQgONNcBjftC+fnxl0GG7TgENydzqjrmOacPminR3svvsXNcDowKL4fQLjeYgO4V t1Blnp0nEFl/BJeniArCuN/cdz8zrpjbxcLFhRxiS5FIhUm8Tmqqt20254K9Il5uI1hl YFIaxMtwzF0Xo0zmVQ46jIFngsE6JMONcSnXxQcx+bjRnHOagVCiD7pM6KwNF3lM3cfR 3shw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pappasbrent.com header.s=default header.b=Bl1SddMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xd9-20020a170907078900b007d6105e0acfsi31422998ejb.501.2023.01.16.11.01.37; Mon, 16 Jan 2023 11:02:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@pappasbrent.com header.s=default header.b=Bl1SddMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbjAPS70 (ORCPT <rfc822;stefanalexe802@gmail.com> + 99 others); Mon, 16 Jan 2023 13:59:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233575AbjAPS7Q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Jan 2023 13:59:16 -0500 X-Greylist: delayed 658 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 16 Jan 2023 10:59:14 PST Received: from h5.fbrelay.privateemail.com (h5.fbrelay.privateemail.com [162.0.218.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B26525E28 for <linux-kernel@vger.kernel.org>; Mon, 16 Jan 2023 10:59:13 -0800 (PST) Received: from MTA-11-3.privateemail.com (mta-11.privateemail.com [198.54.118.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by h5.fbrelay.privateemail.com (Postfix) with ESMTPS id F3656607D2 for <linux-kernel@vger.kernel.org>; Mon, 16 Jan 2023 18:48:12 +0000 (UTC) Received: from mta-11.privateemail.com (localhost [127.0.0.1]) by mta-11.privateemail.com (Postfix) with ESMTP id AA24918000A5; Mon, 16 Jan 2023 13:48:01 -0500 (EST) Received: from bpappas-XPS-13-9310.ucf.edu (050-088-208-136.res.spectrum.com [50.88.208.136]) by mta-11.privateemail.com (Postfix) with ESMTPA id 4905418000AA; Mon, 16 Jan 2023 13:47:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pappasbrent.com; s=default; t=1673894881; bh=7eZ35sq7vCUVk3hra9JJfEa8RywzMOV09hPbJgGfvUU=; h=From:To:Cc:Subject:Date:From; b=Bl1SddMe0MQndGSlzT/1qEvDmy8b2bDbFoRZIITe/g8u3rsWRJKgiuSqnUpIHmCmM LYhvh+0Hn+IBx2jy1ZdBxNl3tC5Fz3Me63rP9J5OkmHytR7E3BhJWEdQ6E/JMfgf92 B9H5xbSs5XEK3GRzRZdUHJoqGMG9Lza9pRsI/fXb0sEXzA5t408mK5gSiCMjhwixAZ 1oKup3SFLrua+sSGvJ1bgehrwYJqjaM96+MfOsUSWq7Znf1P+fXmiT1AnBq9SjlGeW NzI7F7JtxzznJ7aFeoVKsp8QbCWzQJbRQVbHpTWCuKBoLfX28T6lAvSBQIzgtmvqxt IUBrcJ2cVMWXg== From: Brent Pappas <bpappas@pappasbrent.com> To: rmfrfs@gmail.com Cc: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Brent Pappas <bpappas@pappasbrent.com> Subject: [PATCH] staging: greybus: gpio: Replace macro irq_data_to_gpio_chip with function Date: Mon, 16 Jan 2023 13:47:06 -0500 Message-Id: <20230116184707.22302-1-bpappas@pappasbrent.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755206881301751592?= X-GMAIL-MSGID: =?utf-8?q?1755206881301751592?= |
Series |
staging: greybus: gpio: Replace macro irq_data_to_gpio_chip with function
|
|
Commit Message
Brent Pappas
Jan. 16, 2023, 6:47 p.m. UTC
Replace the macro irq_data_to_gpio_chip with a static inline function to comply
with Linux coding style standards.
Signed-off-by: Brent Pappas <bpappas@pappasbrent.com>
---
drivers/staging/greybus/gpio.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Mon, Jan 16, 2023 at 01:47:06PM -0500, Brent Pappas wrote: > Replace the macro irq_data_to_gpio_chip with a static inline function to comply > with Linux coding style standards. > > Signed-off-by: Brent Pappas <bpappas@pappasbrent.com> > --- > drivers/staging/greybus/gpio.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c > index 8a7cf1d0e968..833162ceb385 100644 > --- a/drivers/staging/greybus/gpio.c > +++ b/drivers/staging/greybus/gpio.c > @@ -43,7 +43,11 @@ struct gb_gpio_controller { > }; > #define gpio_chip_to_gb_gpio_controller(chip) \ > container_of(chip, struct gb_gpio_controller, chip) > -#define irq_data_to_gpio_chip(d) (d->domain->host_data) > + > +static inline void *irq_data_to_gpio_chip(struct irq_data *d) 1) Don't make this a void pointer. ->host_data is void but we want to return a struct gpio_chip * type so declare it as returning a gpio_chip struct pointer. A big advantage of function over macros is the type checking. 2) Don't declare it as inline. Modern compilers are smart and confident. They are smart enough to make it inline automatically. And confident enough that they just ignore when people mark stuff as inline. (We have an __always_inline macro for when the compiler is wrong.) regards, dan carpenter
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 8a7cf1d0e968..833162ceb385 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -43,7 +43,11 @@ struct gb_gpio_controller { }; #define gpio_chip_to_gb_gpio_controller(chip) \ container_of(chip, struct gb_gpio_controller, chip) -#define irq_data_to_gpio_chip(d) (d->domain->host_data) + +static inline void *irq_data_to_gpio_chip(struct irq_data *d) +{ + return d->domain->host_data; +} static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc) {