From: Menna Mahmoud <eng.mennamahmoud.mm@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: gregkh@linuxfoundation.org, outreachy@lists.linux.dev,
johan@kernel.org, elder@kernel.org, vireshk@kernel.org,
thierry.reding@gmail.com, greybus-dev@lists.linaro.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
linux-pwm@vger.kernel.org, Julia Lawall <julia.lawall@inria.fr>
Subject: Re: [PATCH 2/3] staging: greybus: use inline function for macros
Date: Tue, 21 Mar 2023 18:25:29 +0200 [thread overview]
Message-ID: <7c883bac-382c-b429-ab21-4675dce02474@gmail.com> (raw)
In-Reply-To: <20230321154728.3r7ut3rl2pccmo2e@pengutronix.de>
On ٢١/٣/٢٠٢٣ ١٧:٤٧, Uwe Kleine-König wrote:
> Hello,
>
> just some nitpicks:
>
> On Tue, Mar 21, 2023 at 01:04:33AM +0200, Menna Mahmoud wrote:
>> Convert `to_gbphy_dev` and `to_gbphy_driver` macros into a
>> static inline function.
>>
>> it is not great to have macro that use `container_of` macro,
> s/it/It/; s/macro/macros/; s/use/use the/;
Okay, I will fix it.
>
>> because from looking at the definition one cannot tell what type
>> it applies to.
>> [...]
>> -#define to_gbphy_dev(d) container_of(d, struct gbphy_device, dev)
>> +static inline struct gbphy_device *to_gbphy_dev(const struct device *d)
> drivers/staging/greybus/gbphy.c always passes a variable named
> "dev" to this macro. So I'd call the parameter "dev", too, instead of
> "d". This is also a more typical name for variables of that type.
>
>> +{
>> + return container_of(d, struct gbphy_device, dev);
>> +}
>> [...]
>> };
>> -#define to_gbphy_driver(d) container_of(d, struct gbphy_driver, driver)
>> +static inline struct gbphy_driver *to_gbphy_driver(struct device_driver *d)
>> +{
>> + return container_of(d, struct gbphy_driver, driver);
>> +}
> With a similar reasoning (and also to not have "d"s that are either
> device or device_driver) I'd recommend "drv" here.
please check this with Julia, because she said they should different.
Thanks,
Menna
>
> Best regards
> Uwe
>
next prev parent reply other threads:[~2023-03-21 16:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 23:04 [PATCH 0/3] edits in greybus driver Menna Mahmoud
2023-03-20 23:04 ` [PATCH 1/3] staging: greybus: remove unnecessary blank line Menna Mahmoud
2023-03-20 23:04 ` [PATCH 2/3] staging: greybus: use inline function for macros Menna Mahmoud
2023-03-21 15:47 ` Uwe Kleine-König
2023-03-21 15:59 ` Julia Lawall
2023-03-21 16:26 ` Uwe Kleine-König
2023-03-21 16:35 ` Julia Lawall
2023-03-21 17:01 ` Greg KH
2023-03-21 16:25 ` Menna Mahmoud [this message]
2023-03-21 16:42 ` Uwe Kleine-König
2023-03-21 17:21 ` Menna Mahmoud
2023-03-20 23:04 ` [PATCH 3/3] staging: greybus: remove unnecessary blank line Menna Mahmoud
2023-03-21 11:46 ` [PATCH 0/3] edits in greybus driver Julia Lawall
2023-03-21 16:22 ` Menna Mahmoud
2023-03-21 16:26 ` Greg KH
2023-03-21 17:24 ` Menna Mahmoud
2023-03-21 16:39 ` Julia Lawall
2023-03-21 17:26 ` Menna Mahmoud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c883bac-382c-b429-ab21-4675dce02474@gmail.com \
--to=eng.mennamahmoud.mm@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox