public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miguel Angel Flores <maf@sombragris.com>
To: linux-kernel@vger.kernel.org
Subject: aic7xxx driver large integer warning
Date: Mon, 06 Dec 2004 01:23:31 +0100	[thread overview]
Message-ID: <41B3A683.8060008@sombragris.com> (raw)

Hi list.

As I said yesterday, the 2.6.10rc3 kernel warns compiling the aic7xxxx 
SCSI driver:

---
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c: In function 
`ahc_linux_pci_dev_probe':
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c:229: warning: large integer 
implicitly truncated to unsigned type
---

[aic7xxx_osm_pci.c]
    mask_39bit = 0x7FFFFFFFFFULL;

mask_39bit type is dma_addr_t. However the length of dma_addr_t is 
defined in types.h.

[types.h]
    #ifdef CONFIG_HIGHMEM64G
    typedef u64 dma_addr_t;
    #else
    typedef u32 dma_addr_t;
    #endif
    typedef u64 dma64_addr_t;

I think the correct solution is to make the assignement only if 
CONFIG_HIGHMEM64G is defined:

[aic7xxx_osm_pci.c]
        mask_39bit = 0x7FFFFFFFFFULL;  //assignement
        if (sizeof(dma_addr_t) > 4 //CONFIG_HIGHMEM64G is defined
         && ahc_linux_get_memsize() > 0x80000000
         && pci_set_dma_mask(pdev, mask_39bit) == 0) {

            /* the correct position of the assignement IMHO */

            ahc->flags |= AHC_39BIT_ADDRESSING;
            ahc->platform_data->hw_dma_mask = mask_39bit;
        } else {
            if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
                printk(KERN_WARNING "aic7xxx: No suitable DMA 
available.\n");
                        return (-ENODEV);
            }
            ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;

Before I post a new patch, I wish to know your opinion.

Thanks,
MaF


             reply	other threads:[~2004-12-06  0:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06  0:23 Miguel Angel Flores [this message]
2004-12-06 13:31 ` aic7xxx driver large integer warning Alan Cox
2004-12-06 17:30   ` Miguel Angel Flores
2004-12-07 12:58     ` Alan Cox

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=41B3A683.8060008@sombragris.com \
    --to=maf@sombragris.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox