2021-09-29 21:28:38

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH V2 0/2] usb: cdc-wdm: Fix config and constify

This series fixes an ifdef of a renamed Kconfig option.

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

V1: https://lore.kernel.org/lkml/[email protected]/

Changes
V2: Use ifdef instead of IS_ENABLED()

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


2021-09-29 21:28:40

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH V2 1/2] usb: cdc-wdm: Fix check for WWAN

CONFIG_WWAN_CORE was with CONFIG_WWAN in commit 89212e160b81 ("net: wwan:
Fix WWAN config symbols"), but did not update all users of it. Change it
back to use CONFIG_WWAN instead.

Fixes: 89212e160b81 ("net: wwan: Fix WWAN config symbols")
Cc: <[email protected]>
Signed-off-by: Rikard Falkeborn <[email protected]>
---
Changes:
V1-V2: Use ifdef instead of IS_ENABLED


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..fdf79bcf7eb0 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
+#ifdef 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

2021-09-29 21:28:40

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH V2 2/2] usb: cdc-wdm: Constify static struct wwan_port_ops

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 <[email protected]>
---
Changes:
V1->V2: No changes

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 fdf79bcf7eb0..7f2c83f299d3 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