From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Jiri Slaby <jirislaby@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/7] tty: serial: samsung: constify s3c24xx_serial_drv_data
Date: Mon, 7 Mar 2022 09:40:26 +0100 [thread overview]
Message-ID: <cf34d431-22ba-ccaa-3622-a098b09a8bfe@canonical.com> (raw)
In-Reply-To: <3eecfcea-8eeb-3ea2-566b-704c314af718@kernel.org>
On 07/03/2022 09:33, Jiri Slaby wrote:
> On 07. 03. 22, 9:09, Krzysztof Kozlowski wrote:
>> The driver data (struct s3c24xx_serial_drv_data) is only used to
>> initialize the driver properly and is not modified. Make it const.
> ...
>> @@ -2755,9 +2755,9 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
>> },
>> .fifosize = { 256, 64, 16, 16 },
>> };
>> -#define S5PV210_SERIAL_DRV_DATA ((kernel_ulong_t)&s5pv210_serial_drv_data)
>> +#define S5PV210_SERIAL_DRV_DATA (&s5pv210_serial_drv_data)
>> #else
>> -#define S5PV210_SERIAL_DRV_DATA (kernel_ulong_t)NULL
>> +#define S5PV210_SERIAL_DRV_DATA NULL
>
> Yet, I still don't see why the switch from ulong->ptr happens in this
> "constify it" patch?
All these defines S5PV210_SERIAL_DRV_DATA and so on are now const and
are assigned to of_device_id.data (s3c24xx_uart_dt_match). Before, these
were assigned with a cast:
static const struct of_device_id s3c24xx_uart_dt_match[] = {
{ .compatible = "samsung,s5pv210-uart",
.data = (void *)S5PV210_SERIAL_DRV_DATA }
but since the actual data structure is const, I want to drop the cast.
Casting const via (void *) might hide some possible issues, e.g. if
of_device_id.data becomes actually non-const. There is no particular
issue here, because of_device_id.data and S5PV210_SERIAL_DRV_DATA are
const. But also because they are both const now, I want to drop the cast
via void *.
When (void *) is dropped, the S5PV210_SERIAL_DRV_DATA cannot be
kernel_ulong_t:
../drivers/tty/serial/samsung_tty.c:2753:33: warning: initialization of
‘const void *’ from ‘long unsigned int’ makes pointer from integer
without a cast [-Wint-conversion]
2753 | #define S5PV210_SERIAL_DRV_DATA (kernel_ulong_t)NULL
Best regards,
Krzysztof
next prev parent reply other threads:[~2022-03-07 8:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220307080826epcas5p13d71054f6b461cff91edbbb2cf42491a@epcas5p1.samsung.com>
2022-03-07 8:08 ` [PATCH v2 0/7] tty: serial: samsung: minor fixes/cleanups Krzysztof Kozlowski
2022-03-07 8:08 ` [PATCH v2 1/7] tty: serial: samsung: embed s3c24xx_uart_info in parent structure Krzysztof Kozlowski
2022-03-07 8:08 ` Krzysztof Kozlowski
2022-03-07 8:10 ` Krzysztof Kozlowski
2022-03-07 8:09 ` [PATCH v2 2/7] tty: serial: samsung: embed s3c2410_uartcfg " Krzysztof Kozlowski
2022-03-07 8:09 ` [PATCH v2 3/7] tty: serial: samsung: constify s3c24xx_serial_drv_data Krzysztof Kozlowski
2022-03-07 8:33 ` Jiri Slaby
2022-03-07 8:40 ` Krzysztof Kozlowski [this message]
2022-03-08 8:06 ` Krzysztof Kozlowski
2022-03-07 18:18 ` Alim Akhtar
2022-03-07 8:09 ` [PATCH v2 4/7] tty: serial: samsung: constify UART name Krzysztof Kozlowski
2022-03-07 8:09 ` [PATCH v2 5/7] tty: serial: samsung: constify s3c24xx_serial_drv_data members Krzysztof Kozlowski
2022-03-07 8:09 ` [PATCH v2 6/7] tty: serial: samsung: constify variables and pointers Krzysztof Kozlowski
2022-03-07 8:09 ` [PATCH v2 7/7] tty: serial: samsung: simplify getting OF match data Krzysztof Kozlowski
2022-03-07 18:16 ` Alim Akhtar
2022-03-07 20:24 ` Andy Shevchenko
2022-03-08 7:19 ` Krzysztof Kozlowski
2022-03-07 18:21 ` [PATCH v2 0/7] tty: serial: samsung: minor fixes/cleanups Alim Akhtar
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=cf34d431-22ba-ccaa-3622-a098b09a8bfe@canonical.com \
--to=krzysztof.kozlowski@canonical.com \
--cc=alim.akhtar@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.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