2013-08-16 13:38:59

by Enrico Mioso

[permalink] [raw]
Subject: [PATCH] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use

Some drivers implementing NCM-like protocols, may re-use those functions, as is
the case in the huawei_cdc_ncm driver.
Export them via EXPORT_SYMBOL_GPL.

Signed-off-by: Enrico Mioso <[email protected]>
---

drivers/net/usb/cdc_ncm.c | 6 ++++--
include/linux/usb/cdc_ncm.h | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 43afde8..62686be 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -858,7 +858,7 @@ static void cdc_ncm_txpath_bh(unsigned long param)
}
}

-static struct sk_buff *
+struct sk_buff *
cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
struct sk_buff *skb_out;
@@ -885,6 +885,7 @@ error:

return NULL;
}
+EXPORT_SYMBOL_GPL(cdc_ncm_tx_fixup);

/* verify NTB header and return offset of first NDP, or negative error */
int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in)
@@ -965,7 +966,7 @@ error:
}
EXPORT_SYMBOL_GPL(cdc_ncm_rx_verify_ndp16);

-static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
+int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
{
struct sk_buff *skb;
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
@@ -1040,6 +1041,7 @@ err_ndp:
error:
return 0;
}
+EXPORT_SYMBOL_GPL(cdc_ncm_rx_fixup);

static void
cdc_ncm_speed_change(struct cdc_ncm_ctx *ctx,
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index cc25b70..163244b 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -133,3 +133,6 @@ extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign);
extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
+struct sk_buff *
+cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
+int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);


2013-08-16 13:47:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use

On Fri, Aug 16, 2013 at 03:39:19PM +0200, Enrico Mioso wrote:
> Some drivers implementing NCM-like protocols, may re-use those functions, as is
> the case in the huawei_cdc_ncm driver.

Where is that driver at, I don't see it in the kernel tree.

> Export them via EXPORT_SYMBOL_GPL.

Normally we don't export symbols until code that actually uses the
symbols lands in the tree at the same time.

thanks,

greg k-h

2013-08-16 13:50:52

by Enrico Mioso

[permalink] [raw]
Subject: Re: [PATCH] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use

Yes, you're right. I'm sorry - this time I didn't apply numbering scheme to
those 3 patches - yet they are consequential, but not depending on each other
from a strict point of view.

Thank you for your review Greg!


On Fri, 16 Aug 2013, Greg Kroah-Hartman wrote:

==Date: Fri, 16 Aug 2013 06:49:07 -0700
==From: Greg Kroah-Hartman <[email protected]>
==To: Enrico Mioso <[email protected]>
==Cc: Bj?rn Mork <[email protected]>, [email protected],
== [email protected], [email protected]
==Subject: Re: [PATCH] net: cdc_ncm: Export cdc_ncm_{tx,
== rx}_fixup functions for re-use
==
==On Fri, Aug 16, 2013 at 03:39:19PM +0200, Enrico Mioso wrote:
==> Some drivers implementing NCM-like protocols, may re-use those functions, as is
==> the case in the huawei_cdc_ncm driver.
==
==Where is that driver at, I don't see it in the kernel tree.
==
==> Export them via EXPORT_SYMBOL_GPL.
==
==Normally we don't export symbols until code that actually uses the
==symbols lands in the tree at the same time.
==
==thanks,
==
==greg k-h
==

2013-08-16 13:51:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use

On Fri, Aug 16, 2013 at 06:49:07AM -0700, Greg Kroah-Hartman wrote:
> On Fri, Aug 16, 2013 at 03:39:19PM +0200, Enrico Mioso wrote:
> > Some drivers implementing NCM-like protocols, may re-use those functions, as is
> > the case in the huawei_cdc_ncm driver.
>
> Where is that driver at, I don't see it in the kernel tree.

And you sent it in a different email, sorry about that.

Normally you would number the patches (i.e. [1/3], and so on), so that
people know which order to apply them in, and that there really is 3
patches in the series...

thanks,

greg k-h