linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: imx: remove unused imx_uart_is_imx* functions
@ 2023-03-17 20:57 Tom Rix
  2023-03-18 14:30 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rix @ 2023-03-17 20:57 UTC (permalink / raw)
  To: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam,
	linux-imx, nathan, ndesaulniers
  Cc: linux-serial, linux-arm-kernel, linux-kernel, llvm, Tom Rix

clang with W=1 reports
drivers/tty/serial/imx.c:292:19: error:
  unused function 'imx_uart_is_imx21' [-Werror,-Wunused-function]
static inline int imx_uart_is_imx21(struct imx_port *sport)
                  ^
drivers/tty/serial/imx.c:297:19: error:
  unused function 'imx_uart_is_imx53' [-Werror,-Wunused-function]
static inline int imx_uart_is_imx53(struct imx_port *sport)
                  ^
drivers/tty/serial/imx.c:302:19: error:
  unused function 'imx_uart_is_imx6q' [-Werror,-Wunused-function]
static inline int imx_uart_is_imx6q(struct imx_port *sport)
                  ^
These static functions are not used, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/tty/serial/imx.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 84bc0e768726..dbb3af4c1a34 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -289,20 +289,6 @@ static inline int imx_uart_is_imx1(struct imx_port *sport)
 	return sport->devdata->devtype == IMX1_UART;
 }
 
-static inline int imx_uart_is_imx21(struct imx_port *sport)
-{
-	return sport->devdata->devtype == IMX21_UART;
-}
-
-static inline int imx_uart_is_imx53(struct imx_port *sport)
-{
-	return sport->devdata->devtype == IMX53_UART;
-}
-
-static inline int imx_uart_is_imx6q(struct imx_port *sport)
-{
-	return sport->devdata->devtype == IMX6Q_UART;
-}
 /*
  * Save and restore functions for UCR1, UCR2 and UCR3 registers
  */
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: imx: remove unused imx_uart_is_imx* functions
  2023-03-17 20:57 [PATCH] serial: imx: remove unused imx_uart_is_imx* functions Tom Rix
@ 2023-03-18 14:30 ` Uwe Kleine-König
  2023-03-18 14:51   ` Tom Rix
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2023-03-18 14:30 UTC (permalink / raw)
  To: Tom Rix
  Cc: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam,
	linux-imx, nathan, ndesaulniers, llvm, linux-arm-kernel,
	linux-serial, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3251 bytes --]

On Fri, Mar 17, 2023 at 04:57:10PM -0400, Tom Rix wrote:
> clang with W=1 reports
> drivers/tty/serial/imx.c:292:19: error:
>   unused function 'imx_uart_is_imx21' [-Werror,-Wunused-function]
> static inline int imx_uart_is_imx21(struct imx_port *sport)
>                   ^
> drivers/tty/serial/imx.c:297:19: error:
>   unused function 'imx_uart_is_imx53' [-Werror,-Wunused-function]
> static inline int imx_uart_is_imx53(struct imx_port *sport)
>                   ^
> drivers/tty/serial/imx.c:302:19: error:
>   unused function 'imx_uart_is_imx6q' [-Werror,-Wunused-function]
> static inline int imx_uart_is_imx6q(struct imx_port *sport)
>                   ^
> These static functions are not used, so remove them.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Funny, is_imx6q_uart() was introduced in
a496e6284c482555db8078190bb689594d129fa9 and never used. Since that
commit is_imx21_uart() also unused. And the imx53 variant was also never
used.

Looking at that a bit more, the following cleanup is also possible (only
compile tested):

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8308a23c55a7..a38ee0ed2210 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -178,8 +178,6 @@
 enum imx_uart_type {
 	IMX1_UART,
 	IMX21_UART,
-	IMX53_UART,
-	IMX6Q_UART,
 };
 
 /* device type dependent stuff */
@@ -241,30 +239,21 @@ struct imx_port_ucrs {
 	unsigned int	ucr3;
 };
 
-static struct imx_uart_data imx_uart_devdata[] = {
-	[IMX1_UART] = {
-		.uts_reg = IMX1_UTS,
-		.devtype = IMX1_UART,
-	},
-	[IMX21_UART] = {
-		.uts_reg = IMX21_UTS,
-		.devtype = IMX21_UART,
-	},
-	[IMX53_UART] = {
-		.uts_reg = IMX21_UTS,
-		.devtype = IMX53_UART,
-	},
-	[IMX6Q_UART] = {
-		.uts_reg = IMX21_UTS,
-		.devtype = IMX6Q_UART,
-	},
+static const struct imx_uart_data imx_uart_imx1_devdata = {
+	.uts_reg = IMX1_UTS,
+	.devtype = IMX1_UART,
+};
+
+static const struct imx_uart_data imx_uart_imx21_devdata = {
+	.uts_reg = IMX21_UTS,
+	.devtype = IMX21_UART,
 };
 
 static const struct of_device_id imx_uart_dt_ids[] = {
-	{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_devdata[IMX6Q_UART], },
-	{ .compatible = "fsl,imx53-uart", .data = &imx_uart_devdata[IMX53_UART], },
-	{ .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], },
-	{ .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], },
+	{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_imx21_devdata, },
+	{ .compatible = "fsl,imx53-uart", .data = &imx_uart_imx21_devdata, },
+	{ .compatible = "fsl,imx1-uart", .data = &imx_uart_imx1_devdata, },
+	{ .compatible = "fsl,imx21-uart", .data = &imx_uart_imx21_devdata, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, imx_uart_dt_ids);

If you feel like squashing that into your commit or put it into a
separate commit with a nice commit log (after convincing yourself that
the change is fine), feel free to do so.

If you don't:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: imx: remove unused imx_uart_is_imx* functions
  2023-03-18 14:30 ` Uwe Kleine-König
@ 2023-03-18 14:51   ` Tom Rix
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Rix @ 2023-03-18 14:51 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: gregkh, jirislaby, shawnguo, s.hauer, kernel, festevam,
	linux-imx, nathan, ndesaulniers, llvm, linux-arm-kernel,
	linux-serial, linux-kernel


On 3/18/23 7:30 AM, Uwe Kleine-König wrote:
> On Fri, Mar 17, 2023 at 04:57:10PM -0400, Tom Rix wrote:
>> clang with W=1 reports
>> drivers/tty/serial/imx.c:292:19: error:
>>    unused function 'imx_uart_is_imx21' [-Werror,-Wunused-function]
>> static inline int imx_uart_is_imx21(struct imx_port *sport)
>>                    ^
>> drivers/tty/serial/imx.c:297:19: error:
>>    unused function 'imx_uart_is_imx53' [-Werror,-Wunused-function]
>> static inline int imx_uart_is_imx53(struct imx_port *sport)
>>                    ^
>> drivers/tty/serial/imx.c:302:19: error:
>>    unused function 'imx_uart_is_imx6q' [-Werror,-Wunused-function]
>> static inline int imx_uart_is_imx6q(struct imx_port *sport)
>>                    ^
>> These static functions are not used, so remove them.
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
> Funny, is_imx6q_uart() was introduced in
> a496e6284c482555db8078190bb689594d129fa9 and never used. Since that
> commit is_imx21_uart() also unused. And the imx53 variant was also never
> used.
>
> Looking at that a bit more, the following cleanup is also possible (only
> compile tested):
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 8308a23c55a7..a38ee0ed2210 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -178,8 +178,6 @@
>   enum imx_uart_type {
>   	IMX1_UART,
>   	IMX21_UART,
> -	IMX53_UART,
> -	IMX6Q_UART,
>   };
>   
>   /* device type dependent stuff */
> @@ -241,30 +239,21 @@ struct imx_port_ucrs {
>   	unsigned int	ucr3;
>   };
>   
> -static struct imx_uart_data imx_uart_devdata[] = {
> -	[IMX1_UART] = {
> -		.uts_reg = IMX1_UTS,
> -		.devtype = IMX1_UART,
> -	},
> -	[IMX21_UART] = {
> -		.uts_reg = IMX21_UTS,
> -		.devtype = IMX21_UART,
> -	},
> -	[IMX53_UART] = {
> -		.uts_reg = IMX21_UTS,
> -		.devtype = IMX53_UART,
> -	},
> -	[IMX6Q_UART] = {
> -		.uts_reg = IMX21_UTS,
> -		.devtype = IMX6Q_UART,
> -	},
> +static const struct imx_uart_data imx_uart_imx1_devdata = {
> +	.uts_reg = IMX1_UTS,
> +	.devtype = IMX1_UART,
> +};
> +
> +static const struct imx_uart_data imx_uart_imx21_devdata = {
> +	.uts_reg = IMX21_UTS,
> +	.devtype = IMX21_UART,
>   };
>   
>   static const struct of_device_id imx_uart_dt_ids[] = {
> -	{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_devdata[IMX6Q_UART], },
> -	{ .compatible = "fsl,imx53-uart", .data = &imx_uart_devdata[IMX53_UART], },
> -	{ .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], },
> -	{ .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], },
> +	{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_imx21_devdata, },
> +	{ .compatible = "fsl,imx53-uart", .data = &imx_uart_imx21_devdata, },
> +	{ .compatible = "fsl,imx1-uart", .data = &imx_uart_imx1_devdata, },
> +	{ .compatible = "fsl,imx21-uart", .data = &imx_uart_imx21_devdata, },
>   	{ /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(of, imx_uart_dt_ids);
>
> If you feel like squashing that into your commit or put it into a
> separate commit with a nice commit log (after convincing yourself that
> the change is fine), feel free to do so.
>
> If you don't:

My interest is not in imx specifically, but rather cleaning up all the 
unused functions.

I _think_ I can get the list of around 70 down to around 10 but it will 
take a while.

Tom


>
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> Best regards
> Uwe
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-18 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 20:57 [PATCH] serial: imx: remove unused imx_uart_is_imx* functions Tom Rix
2023-03-18 14:30 ` Uwe Kleine-König
2023-03-18 14:51   ` Tom Rix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).