All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <samuel@sortiz.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, irda-users@lists.sourceforge.net
Subject: [RFC PATCH 3/9] irda: IrDA drivers should call irda_get_skb_cb()
Date: Mon, 15 Dec 2008 02:57:32 +0100	[thread overview]
Message-ID: <20081215015858.436580648@sortiz.org> (raw)
In-Reply-To: 20081215015729.587697008@sortiz.org

[-- Attachment #1: 0003-irda-IrDA-drivers-should-call-irda_get_skb_cb.patch --]
[-- Type: text/plain, Size: 3556 bytes --]

Instead of accessing irda_skb_cb directly, irda drivers should call
irda_get_skb_cb().

Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
---
 drivers/net/irda/donauboe.c |    9 +--------
 drivers/net/irda/irda-usb.c |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 69d16b3..1f0f9ee 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -977,20 +977,13 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
   __s32 speed;
   int mtt, len, ctl;
   unsigned long flags;
-  struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
 
   self = (struct toshoboe_cb *) dev->priv;
 
   IRDA_ASSERT (self != NULL, return 0; );
 
   IRDA_DEBUG (1, "%s.tx:%x(%x)%x\n", __func__
-      ,skb->len,self->txpending,INB (OBOE_ENABLEH));
-  if (!cb->magic) {
-      IRDA_DEBUG (2, "%s.Not IrLAP:%x\n", __func__, cb->magic);
-#ifdef DUMP_PACKETS
-      _dumpbufs(skb->data,skb->len,'>');
-#endif
-    }
+	      , skb->len, self->txpending, INB(OBOE_ENABLEH));
 
   /* change speed pending, wait for its execution */
   if (self->new_speed)
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index b5d6b9a..f5c13af 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -385,6 +385,7 @@ static void speed_bulk_callback(struct urb *urb)
 static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
 	struct irda_usb_cb *self = netdev->priv;
+	struct irda_skb_cb *cb;
 	struct urb *urb = self->tx_urb;
 	unsigned long flags;
 	s32 speed;
@@ -464,7 +465,8 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
 	}
 
 	/* FIXME: Make macro out of this one */
-	((struct irda_skb_cb *)skb->cb)->context = self;
+	cb = irda_get_skb_cb(skb);
+	cb->context = self;
 
 	usb_fill_bulk_urb(urb, self->usbdev,
 		      usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
@@ -554,10 +556,16 @@ static void write_bulk_callback(struct urb *urb)
 {
 	unsigned long flags;
 	struct sk_buff *skb = urb->context;
-	struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context;
+	struct irda_skb_cb *cb;
+	struct irda_usb_cb *self;
 	
 	IRDA_DEBUG(2, "%s()\n", __func__);
 
+	cb = irda_get_skb_cb(skb);
+	IRDA_ASSERT(cb != NULL, return;);
+
+	self = cb->context;
+
 	/* We should always have a context */
 	IRDA_ASSERT(self != NULL, return;);
 	/* We should always be called for the speed URB */
@@ -770,7 +778,7 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
 	IRDA_ASSERT(urb != NULL, return;);
 
 	/* Save ourselves in the skb */
-	cb = (struct irda_skb_cb *) skb->cb;
+	cb = irda_get_skb_cb(skb);
 	cb->context = self;
 
 	/* Reinitialize URB */
@@ -810,7 +818,7 @@ static void irda_usb_receive(struct urb *urb)
 	IRDA_DEBUG(2, "%s(), len=%d\n", __func__, urb->actual_length);
 	
 	/* Find ourselves */
-	cb = (struct irda_skb_cb *) skb->cb;
+	cb = irda_get_skb_cb(skb);
 	IRDA_ASSERT(cb != NULL, return;);
 	self = (struct irda_usb_cb *) cb->context;
 	IRDA_ASSERT(self != NULL, return;);
@@ -970,7 +978,8 @@ static void irda_usb_rx_defer_expired(unsigned long data)
 	IRDA_DEBUG(2, "%s()\n", __func__);
 
 	/* Find ourselves */
-	cb = (struct irda_skb_cb *) skb->cb;
+	cb = irda_get_skb_cb(skb);
+
 	IRDA_ASSERT(cb != NULL, return;);
 	self = (struct irda_usb_cb *) cb->context;
 	IRDA_ASSERT(self != NULL, return;);
-- 
1.6.0.4.766.g6fc4a.dirty

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

  parent reply	other threads:[~2008-12-15  2:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15  1:57 [RFC PATCH 0/9] IrDA 2.6.28 bug fix Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 1/9] irda: Introduce irda_alloc_skb Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 2/9] irda: stack should call irda_get_skb_cb() Samuel Ortiz
2008-12-15  1:57 ` Samuel Ortiz [this message]
2008-12-15  1:57 ` [RFC PATCH 4/9] irda: reserve irda_skb on sock_alloc_send_skb() skbs Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 5/9] irda: Introduce irda_dev_alloc_skb Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 6/9] irda: Drivers should use irda_dev_alloc_skb() on the RX path Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 7/9] irda: Stack RX path callers should use irda_dev_alloc_skb Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 8/9] irda: Add a WARN_ON when our head room is too small Samuel Ortiz
2008-12-15  1:57 ` [RFC PATCH 9/9] irda: Fix irda_skb_cb size Samuel Ortiz
     [not found] ` <20081215015729.587697008-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2008-12-15  7:08   ` [RFC PATCH 0/9] IrDA 2.6.28 bug fix David Miller
2008-12-15 12:31     ` [irda-users] " Samuel Ortiz
2008-12-17  7:59       ` David Miller

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=20081215015858.436580648@sortiz.org \
    --to=samuel@sortiz.org \
    --cc=davem@davemloft.net \
    --cc=irda-users@lists.sourceforge.net \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.