public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix gcc warning on 64 bit compile of gdth
@ 2005-01-03 21:45 James Bottomley
  2005-01-03 22:43 ` Al Viro
  0 siblings, 1 reply; 16+ messages in thread
From: James Bottomley @ 2005-01-03 21:45 UTC (permalink / raw)
  To: achim_leubner; +Cc: SCSI Mailing List

This warning:

drivers/scsi/gdth.c: In function `gdth_fill_raw_cmd':
drivers/scsi/gdth.c:2948: warning: cast to pointer from integer of
different size
drivers/scsi/gdth.c:2950: warning: cast to pointer from integer of
different size
drivers/scsi/gdth.c: In function `gdth_sync_event':
drivers/scsi/gdth.c:3644: warning: cast from pointer to integer of
different size
drivers/scsi/gdth.c:3646: warning: cast from pointer to integer of
different size

can be fixed with the following patch.

James

===== drivers/scsi/gdth.c 1.47 vs edited =====
--- 1.47/drivers/scsi/gdth.c	2005-01-03 10:53:29 -06:00
+++ edited/drivers/scsi/gdth.c	2005-01-03 11:09:32 -06:00
@@ -2945,9 +2945,9 @@
         offset = (ulong)scp->sense_buffer & ~PAGE_MASK;
         sense_paddr = pci_map_page(ha->pdev,page,offset,
                                    16,PCI_DMA_FROMDEVICE);
-        scp->SCp.buffer = (struct scatterlist *)((ulong32)sense_paddr);
+        scp->SCp.buffer = (struct scatterlist *)((unsigned long)sense_paddr);
         /* high part, if 64bit */
-        scp->host_scribble = (char *)(ulong32)((ulong64)sense_paddr >> 32);
+        scp->host_scribble = (char *)(unsigned long)((ulong64)sense_paddr >> 32);
         cmdp->OpCode           = GDT_WRITE;             /* always */
         cmdp->BoardNode        = LOCALBOARD;
         if (mode64) { 
@@ -3641,9 +3641,9 @@
                            scp->request_bufflen,scp->SCp.Message);
         if (scp->SCp.buffer) {
             dma_addr_t addr;
-            addr = (dma_addr_t)(ulong32)scp->SCp.buffer;
+            addr = (dma_addr_t)(unsigned long)scp->SCp.buffer;
             if (scp->host_scribble)
-                addr += (dma_addr_t)((ulong64)(ulong32)scp->host_scribble << 32);               
+                addr += (dma_addr_t)((ulong64)(unsigned long)scp->host_scribble << 32);               
             pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE);
         }
 



^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [PATCH] fix gcc warning on 64 bit compile of gdth
@ 2005-01-04  9:29 Leubner, Achim
  2005-01-04  9:32 ` Arjan van de Ven
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Leubner, Achim @ 2005-01-04  9:29 UTC (permalink / raw)
  To: Christoph Hellwig, Al Viro; +Cc: James Bottomley, SCSI Mailing List

You are right, in gdth_fill_raw_command() the driver is doing two
different dma mappings, one for the data buffer stored in
SCp.dma_handle, and the second for the sense buffer stored in SCp.buffer
and host_scribble. So reuse of dma_handle does not work here.
And, you are right, this is ugly and brittle, but there is no remaining
space in the SCp scratch area to save the second dma mapping.  
The other patches look fine for me, thanks. But what's the reason to
remove the support of 2.2.x and 2.4.x without the full dma API?

Thanks,
Achim

----------------------------------------------
Achim Leubner
Research & Development
ICP vortex Computersysteme GmbH
Gostritzer Str. 61-63
D-01217 Dresden, Germany
Phone: +49-351-871-8291
Fax: +49-351-871-8448
Email: achim_leubner@adaptec.com
Web: www.icp-vortex.com



> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@infradead.org]
> Sent: Dienstag, 4. Januar 2005 09:27
> To: Al Viro
> Cc: James Bottomley; Leubner, Achim; SCSI Mailing List
> Subject: Re: [PATCH] fix gcc warning on 64 bit compile of gdth
> 
> On Mon, Jan 03, 2005 at 10:54:01PM +0000, Al Viro wrote:
> > ... and dma_handle *is* dma_addr_t and gets used in exact same
driver to
> > store the results of the same function (grep for pci_map_page in
there).
> 
> But as it looks do me the driver is doing two different dma mappings
in
> here.


^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [PATCH] fix gcc warning on 64 bit compile of gdth
@ 2005-01-04 10:57 Leubner, Achim
  2005-01-04 11:53 ` Al Viro
  0 siblings, 1 reply; 16+ messages in thread
From: Leubner, Achim @ 2005-01-04 10:57 UTC (permalink / raw)
  To: Al Viro, Arjan van de Ven
  Cc: Christoph Hellwig, James Bottomley, SCSI Mailing List

Yes, that's the problem. I have to pass a physical address of
scp->sense_buffer to our controller firmware that the firmware can fill
that space with DMA after I/O. But cmdp->u.{raw,raw64}.sense_data does
not survive until we get to unmapping stuff in gdth_sync_event() because
there is only one cmdp structure per controller and the controller can
handle multiple commands. So I have to save the physical address
anywhere in the Scsi_Cmnd structure.
You are right, some pci_map...() checking stuff should be added.

> -----Original Message-----
> From: Al Viro [mailto:viro@www.linux.org.uk] On Behalf Of Al Viro
> Sent: Dienstag, 4. Januar 2005 11:30
> To: Arjan van de Ven
> Cc: Leubner, Achim; Christoph Hellwig; James Bottomley; SCSI Mailing
List
> Subject: Re: [PATCH] fix gcc warning on 64 bit compile of gdth
> 
> On Tue, Jan 04, 2005 at 10:32:41AM +0100, Arjan van de Ven wrote:
> > On Tue, 2005-01-04 at 10:29 +0100, Leubner, Achim wrote:
> > > You are right, in gdth_fill_raw_command() the driver is doing two
> > > different dma mappings, one for the data buffer stored in
> > > SCp.dma_handle, and the second for the sense buffer stored in
SCp.buffer
> > > and host_scribble. So reuse of dma_handle does not work here.
> >
> > Is there a way the driver can get rid of looking at the sense buffer
at
> > all and let the midlayer do this ?
> 
> AFAICS, hardware wants dma_address of that puppy passed to it.  Which
might
> be a solution of this problem, if that address is not clobbered and
can
> be read back from where we'd stored it.  But that's a question for
hardware
> folks - does the value of cmdp->u.{raw,raw64}.sense_data survive until
we
> get to unmapping stuff in gdth_sync_event()?
> 
> In any case, we really should check for failure of pci_map_...() and
be
> more careful with checking if two areas need to be unmapped...

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [PATCH] fix gcc warning on 64 bit compile of gdth
@ 2005-01-04 12:08 Leubner, Achim
  0 siblings, 0 replies; 16+ messages in thread
From: Leubner, Achim @ 2005-01-04 12:08 UTC (permalink / raw)
  To: Al Viro
  Cc: Arjan van de Ven, Christoph Hellwig, James Bottomley,
	SCSI Mailing List

Agreed. Adding a new field in cmd_tab[] is a good possibility to solve
the problem.

gdth_ctr_vtab[] is used in kernel 2.4.x in gdth_proc_info()
(gdth_proc.c) to find the right ha and bus number. The background of
gdth_ctr_vtab[] is a problem of older cdrecord versions with controllers
with more than one bus. In this case the driver gave the possibility to
split the controller into multiple controllers with one bus each
(command line switch "virt_ctr:Y").


> -----Original Message-----
> From: Al Viro [mailto:viro@www.linux.org.uk] On Behalf Of Al Viro
> Sent: Dienstag, 4. Januar 2005 12:53
> To: Leubner, Achim
> Cc: Arjan van de Ven; Christoph Hellwig; James Bottomley; SCSI Mailing
List
> Subject: Re: [PATCH] fix gcc warning on 64 bit compile of gdth
> 
> On Tue, Jan 04, 2005 at 11:57:33AM +0100, Leubner, Achim wrote:
> > Yes, that's the problem. I have to pass a physical address of
> > scp->sense_buffer to our controller firmware that the firmware can
fill
> > that space with DMA after I/O. But cmdp->u.{raw,raw64}.sense_data
does
> > not survive until we get to unmapping stuff in gdth_sync_event()
because
> > there is only one cmdp structure per controller and the controller
can
> > handle multiple commands. So I have to save the physical address
> > anywhere in the Scsi_Cmnd structure.
> 
> Umm...   What about adding a new field to
>     struct {
>         Scsi_Cmnd       *cmnd;                  /* pending request */
>         ushort          service;                /* service */
>     } cmd_tab[GDTH_MAXCMDS];                    /* table of pend.
reques
> in gdth_ha_str?  It's not that we couldn't change size of that animal
and
> AFAICS anything that might be passed to gdth_sync_event() would have
to
> be extracted from ha->cmd_tab[] anyway...
> 
> BTW, what uses values stored in gdth_ctr_vtab[]?  It's static and
gdth.[ch]
> never read its elements, only set them...

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

end of thread, other threads:[~2005-01-05 11:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-03 21:45 [PATCH] fix gcc warning on 64 bit compile of gdth James Bottomley
2005-01-03 22:43 ` Al Viro
2005-01-03 22:49   ` James Bottomley
2005-01-03 22:54     ` Al Viro
2005-01-03 23:53       ` James Bottomley
2005-01-04  4:52         ` Al Viro
2005-01-04  8:27       ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2005-01-04  9:29 Leubner, Achim
2005-01-04  9:32 ` Arjan van de Ven
2005-01-04 10:29   ` Al Viro
2005-01-05 11:19   ` Christoph Hellwig
2005-01-04 14:55 ` James Bottomley
2005-01-05 11:19 ` Christoph Hellwig
2005-01-04 10:57 Leubner, Achim
2005-01-04 11:53 ` Al Viro
2005-01-04 12:08 Leubner, Achim

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