public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ISDN/capidrv: address two longstanding warnings
@ 2007-10-26  9:43 Jeff Garzik
  2007-10-26 16:43 ` Karsten Keil
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-10-26  9:43 UTC (permalink / raw)
  To: LKML; +Cc: akpm, kkeil, isdn4linux

* change #warning to a code comment

* add comment and special ifdef'd 64-bit code for a situation where
  we must store a pointer into a CAPI field 'Data', which is fixed by
  the interface at 32 bits.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/capi/capidrv.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 476012b..48c1775 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1843,6 +1843,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
 	int msglen;
 	u16 errcode;
 	u16 datahandle;
+	u32 data;
 
 	if (!card) {
 		printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n",
@@ -1860,9 +1861,26 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
 		return 0;
 	}
 	datahandle = nccip->datahandle;
+
+	/*
+	 * Here we copy pointer skb->data into the 32-bit 'Data' field.
+	 * The 'Data' field is not used in practice in linux kernel
+	 * (neither in 32 or 64 bit), but should have some value,
+	 * since a CAPI message trace will display it.
+	 *
+	 * The correct value in the 32 bit case is the address of the
+	 * data, in 64 bit it makes no sense, we use 0 there.
+	 */
+
+#ifdef CONFIG_64BIT
+	data = 0;
+#else
+	data = (unsigned long) skb->data;
+#endif
+
 	capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
 			      nccip->ncci,	/* adr */
-			      (u32) skb->data,	/* Data */
+			      data,		/* Data */
 			      skb->len,		/* DataLength */
 			      datahandle,	/* DataHandle */
 			      0	/* Flags */
@@ -2123,7 +2141,10 @@ static int capidrv_delcontr(u16 contr)
 		printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr);
 		return -1;
 	}
-	#warning FIXME: maybe a race condition the card should be removed here from global list /kkeil
+
+	/* FIXME: maybe a race condition the card should be removed
+	 * here from global list /kkeil
+	 */
 	spin_unlock_irqrestore(&global_lock, flags);
 
 	del_timer(&card->listentimer);
-- 
1.5.2.4


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

* Re: [PATCH v2] ISDN/capidrv: address two longstanding warnings
  2007-10-26  9:43 [PATCH v2] ISDN/capidrv: address two longstanding warnings Jeff Garzik
@ 2007-10-26 16:43 ` Karsten Keil
  2007-10-26 22:41   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Karsten Keil @ 2007-10-26 16:43 UTC (permalink / raw)
  To: LKML; +Cc: Jeff Garzik, akpm, kkeil, isdn4linux

* change #warning to a code comment

* add comment and special ifdef'd 64-bit code for a situation where
  we must store a pointer into a CAPI field 'Data', which is fixed by
  the interface at 32 bits.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: Karsten Keil <kkeil@suse.de>

---
 drivers/isdn/capi/capidrv.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 476012b..48c1775 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1843,6 +1843,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
 	int msglen;
 	u16 errcode;
 	u16 datahandle;
+	u32 data;
 
 	if (!card) {
 		printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n",
@@ -1860,9 +1861,26 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
 		return 0;
 	}
 	datahandle = nccip->datahandle;
+
+	/*
+	 * Here we copy pointer skb->data into the 32-bit 'Data' field.
+	 * The 'Data' field is not used in practice in linux kernel
+	 * (neither in 32 or 64 bit), but should have some value,
+	 * since a CAPI message trace will display it.
+	 *
+	 * The correct value in the 32 bit case is the address of the
+	 * data, in 64 bit it makes no sense, we use 0 there.
+	 */
+
+#ifdef CONFIG_64BIT
+	data = 0;
+#else
+	data = (unsigned long) skb->data;
+#endif
+
 	capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
 			      nccip->ncci,	/* adr */
-			      (u32) skb->data,	/* Data */
+			      data,		/* Data */
 			      skb->len,		/* DataLength */
 			      datahandle,	/* DataHandle */
 			      0	/* Flags */
@@ -2123,7 +2141,10 @@ static int capidrv_delcontr(u16 contr)
 		printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr);
 		return -1;
 	}
-	#warning FIXME: maybe a race condition the card should be removed here from global list /kkeil
+
+	/* FIXME: maybe a race condition the card should be removed
+	 * here from global list /kkeil
+	 */
 	spin_unlock_irqrestore(&global_lock, flags);
 
 	del_timer(&card->listentimer);
-- 
1.5.2.4

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

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

* Re: [PATCH v2] ISDN/capidrv: address two longstanding warnings
  2007-10-26 16:43 ` Karsten Keil
@ 2007-10-26 22:41   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-10-26 22:41 UTC (permalink / raw)
  To: LKML, Jeff Garzik, akpm, kkeil, isdn4linux

Karsten Keil wrote:
> * change #warning to a code comment
> 
> * add comment and special ifdef'd 64-bit code for a situation where
>   we must store a pointer into a CAPI field 'Data', which is fixed by
>   the interface at 32 bits.
> 
> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
> Acked-by: Karsten Keil <kkeil@suse.de>

thanks!



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

end of thread, other threads:[~2007-10-26 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26  9:43 [PATCH v2] ISDN/capidrv: address two longstanding warnings Jeff Garzik
2007-10-26 16:43 ` Karsten Keil
2007-10-26 22:41   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox