linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: cdc-wdm: Fix config and constify
@ 2021-09-29 13:21 Rikard Falkeborn
  2021-09-29 13:21 ` [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN Rikard Falkeborn
  2021-09-29 13:21 ` [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops Rikard Falkeborn
  0 siblings, 2 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-09-29 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Loic Poulain, Wei Yongjun
  Cc: Oliver Neukum, Tetsuo Handa, Junlin Yang, linux-usb,
	linux-kernel, Rikard Falkeborn

This series fixes an wrong ifdef which caused a chunk of the code to
never be compiled, regardless of config selected.

While at it, constify a static struct full of function pointers.

Rikard Falkeborn (2):
  usb: cdc-wdm: Fix check for WWAN
  usb: cdc-wdm: Constify static struct wwan_port_ops

 drivers/usb/class/cdc-wdm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.33.0


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

* [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN
  2021-09-29 13:21 [PATCH 0/2] usb: cdc-wdm: Fix config and constify Rikard Falkeborn
@ 2021-09-29 13:21 ` Rikard Falkeborn
  2021-09-29 19:38   ` Rikard Falkeborn
  2021-09-30  9:06   ` Oliver Neukum
  2021-09-29 13:21 ` [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops Rikard Falkeborn
  1 sibling, 2 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-09-29 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Loic Poulain, Wei Yongjun
  Cc: Oliver Neukum, Tetsuo Handa, Junlin Yang, linux-usb,
	linux-kernel, Rikard Falkeborn, stable

Commit 5c912e679506 ("usb: cdc-wdm: fix build error when CONFIG_WWAN_CORE
is not set") fixed a build error when CONFIG_WWAN was set but
CONFIG_WWAN_CORE was not. Since then CONFIG_WWAN_CORE was removed and
joined with CONFIG_WWAN in commit 89212e160b81 ("net: wwan: Fix WWAN
config symbols").

Also, since CONFIG_WWAN has class tri-state instead of bool, we cannot
check if it is defined directly, but have to use IS_DEFINED() instead.

Fixes: 5c912e679506 ("usb: cdc-wdm: fix build error when CONFIG_WWAN_CORE is not set")
Cc: <stable@vger.kernel.org>
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/usb/class/cdc-wdm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 35d5908b5478..03b25aaaa1dd 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -824,7 +824,7 @@ static struct usb_class_driver wdm_class = {
 };
 
 /* --- WWAN framework integration --- */
-#ifdef CONFIG_WWAN_CORE
+#if IS_ENABLED(CONFIG_WWAN)
 static int wdm_wwan_port_start(struct wwan_port *port)
 {
 	struct wdm_device *desc = wwan_port_get_drvdata(port);
@@ -963,11 +963,11 @@ static void wdm_wwan_rx(struct wdm_device *desc, int length)
 	/* inbuf has been copied, it is safe to check for outstanding data */
 	schedule_work(&desc->service_outs_intr);
 }
-#else /* CONFIG_WWAN_CORE */
+#else /* CONFIG_WWAN */
 static void wdm_wwan_init(struct wdm_device *desc) {}
 static void wdm_wwan_deinit(struct wdm_device *desc) {}
 static void wdm_wwan_rx(struct wdm_device *desc, int length) {}
-#endif /* CONFIG_WWAN_CORE */
+#endif /* CONFIG_WWAN */
 
 /* --- error handling --- */
 static void wdm_rxwork(struct work_struct *work)
-- 
2.33.0


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

* [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops
  2021-09-29 13:21 [PATCH 0/2] usb: cdc-wdm: Fix config and constify Rikard Falkeborn
  2021-09-29 13:21 ` [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN Rikard Falkeborn
@ 2021-09-29 13:21 ` Rikard Falkeborn
  2021-09-30  9:08   ` Oliver Neukum
  1 sibling, 1 reply; 6+ messages in thread
From: Rikard Falkeborn @ 2021-09-29 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Loic Poulain, Wei Yongjun
  Cc: Oliver Neukum, Tetsuo Handa, Junlin Yang, linux-usb,
	linux-kernel, Rikard Falkeborn

The only usage of wdm_wwan_port_ops is to pass its address to
wwan_create_port() which takes a pointer to const wwan_port_ops as
argument. Make it const to allow the compiler to put it in read-only
memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/usb/class/cdc-wdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 03b25aaaa1dd..e5834f1228f9 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -911,7 +911,7 @@ static int wdm_wwan_port_tx(struct wwan_port *port, struct sk_buff *skb)
 	return rv;
 }
 
-static struct wwan_port_ops wdm_wwan_port_ops = {
+static const struct wwan_port_ops wdm_wwan_port_ops = {
 	.start = wdm_wwan_port_start,
 	.stop = wdm_wwan_port_stop,
 	.tx = wdm_wwan_port_tx,
-- 
2.33.0


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

* Re: [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN
  2021-09-29 13:21 ` [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN Rikard Falkeborn
@ 2021-09-29 19:38   ` Rikard Falkeborn
  2021-09-30  9:06   ` Oliver Neukum
  1 sibling, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-09-29 19:38 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Greg Kroah-Hartman, Loic Poulain, Wei Yongjun, Oliver Neukum,
	Tetsuo Handa, Junlin Yang, linux-usb, linux-kernel, stable

On Wed, Sep 29, 2021 at 03:21:42PM +0200, Rikard Falkeborn wrote:
> Commit 5c912e679506 ("usb: cdc-wdm: fix build error when CONFIG_WWAN_CORE
> is not set") fixed a build error when CONFIG_WWAN was set but
> CONFIG_WWAN_CORE was not. Since then CONFIG_WWAN_CORE was removed and
> joined with CONFIG_WWAN in commit 89212e160b81 ("net: wwan: Fix WWAN
> config symbols").
> 
> Also, since CONFIG_WWAN has class tri-state instead of bool, we cannot
> check if it is defined directly, but have to use IS_DEFINED() instead.

That last part is wrong, sorry for the noise. I'll send a V2.

Rikard

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

* Re: [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN
  2021-09-29 13:21 ` [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN Rikard Falkeborn
  2021-09-29 19:38   ` Rikard Falkeborn
@ 2021-09-30  9:06   ` Oliver Neukum
  1 sibling, 0 replies; 6+ messages in thread
From: Oliver Neukum @ 2021-09-30  9:06 UTC (permalink / raw)
  To: Rikard Falkeborn, Greg Kroah-Hartman, Loic Poulain, Wei Yongjun
  Cc: Oliver Neukum, Tetsuo Handa, Junlin Yang, linux-usb,
	linux-kernel, stable


On 29.09.21 15:21, Rikard Falkeborn wrote:
> Commit 5c912e679506 ("usb: cdc-wdm: fix build error when CONFIG_WWAN_CORE
> is not set") fixed a build error when CONFIG_WWAN was set but
> CONFIG_WWAN_CORE was not. Since then CONFIG_WWAN_CORE was removed and
> joined with CONFIG_WWAN in commit 89212e160b81 ("net: wwan: Fix WWAN
> config symbols").
>
> Also, since CONFIG_WWAN has class tri-state instead of bool, we cannot
> check if it is defined directly, but have to use IS_DEFINED() instead.
>
> Fixes: 5c912e679506 ("usb: cdc-wdm: fix build error when CONFIG_WWAN_CORE is not set")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.com>


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

* Re: [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops
  2021-09-29 13:21 ` [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops Rikard Falkeborn
@ 2021-09-30  9:08   ` Oliver Neukum
  0 siblings, 0 replies; 6+ messages in thread
From: Oliver Neukum @ 2021-09-30  9:08 UTC (permalink / raw)
  To: Rikard Falkeborn, Greg Kroah-Hartman, Loic Poulain, Wei Yongjun
  Cc: Oliver Neukum, Tetsuo Handa, Junlin Yang, linux-usb, linux-kernel


On 29.09.21 15:21, Rikard Falkeborn wrote:
> The only usage of wdm_wwan_port_ops is to pass its address to
> wwan_create_port() which takes a pointer to const wwan_port_ops as
> argument. Make it const to allow the compiler to put it in read-only
> memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.com>


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

end of thread, other threads:[~2021-09-30  9:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 13:21 [PATCH 0/2] usb: cdc-wdm: Fix config and constify Rikard Falkeborn
2021-09-29 13:21 ` [PATCH 1/2] usb: cdc-wdm: Fix check for WWAN Rikard Falkeborn
2021-09-29 19:38   ` Rikard Falkeborn
2021-09-30  9:06   ` Oliver Neukum
2021-09-29 13:21 ` [PATCH 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops Rikard Falkeborn
2021-09-30  9:08   ` Oliver Neukum

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).