diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-03-22 23:30:34 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-22 23:30:34 -0500 |
commit | 142877b07fe1ef1816513b20f65a51c6ffcadb8b (patch) | |
tree | bdd2f40f6a5897323d8a80deddf41759145094e9 /drivers/scsi | |
parent | b7ad6d75028d021362221d9b2db19fcff995c3f8 (diff) |
[libata sata_sil24] cleanups: use pci_iomap(), kzalloc()
* libata will soon move to iomap, so we should use
pci_iomap() and pci_iounmap().
* Use kzalloc() where appropriate.
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sata_sil24.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 5d01e5ce5ac5..3efebea211f2 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -842,9 +842,10 @@ static void sil24_port_stop(struct ata_port *ap) | |||
842 | static void sil24_host_stop(struct ata_host_set *host_set) | 842 | static void sil24_host_stop(struct ata_host_set *host_set) |
843 | { | 843 | { |
844 | struct sil24_host_priv *hpriv = host_set->private_data; | 844 | struct sil24_host_priv *hpriv = host_set->private_data; |
845 | struct pci_dev *pdev = to_pci_dev(host_set->dev); | ||
845 | 846 | ||
846 | iounmap(hpriv->host_base); | 847 | pci_iounmap(pdev, hpriv->host_base); |
847 | iounmap(hpriv->port_base); | 848 | pci_iounmap(pdev, hpriv->port_base); |
848 | kfree(hpriv); | 849 | kfree(hpriv); |
849 | } | 850 | } |
850 | 851 | ||
@@ -871,26 +872,23 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
871 | goto out_disable; | 872 | goto out_disable; |
872 | 873 | ||
873 | rc = -ENOMEM; | 874 | rc = -ENOMEM; |
874 | /* ioremap mmio registers */ | 875 | /* map mmio registers */ |
875 | host_base = ioremap(pci_resource_start(pdev, 0), | 876 | host_base = pci_iomap(pdev, 0, 0); |
876 | pci_resource_len(pdev, 0)); | ||
877 | if (!host_base) | 877 | if (!host_base) |
878 | goto out_free; | 878 | goto out_free; |
879 | port_base = ioremap(pci_resource_start(pdev, 2), | 879 | port_base = pci_iomap(pdev, 2, 0); |
880 | pci_resource_len(pdev, 2)); | ||
881 | if (!port_base) | 880 | if (!port_base) |
882 | goto out_free; | 881 | goto out_free; |
883 | 882 | ||
884 | /* allocate & init probe_ent and hpriv */ | 883 | /* allocate & init probe_ent and hpriv */ |
885 | probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); | 884 | probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); |
886 | if (!probe_ent) | 885 | if (!probe_ent) |
887 | goto out_free; | 886 | goto out_free; |
888 | 887 | ||
889 | hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL); | 888 | hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); |
890 | if (!hpriv) | 889 | if (!hpriv) |
891 | goto out_free; | 890 | goto out_free; |
892 | 891 | ||
893 | memset(probe_ent, 0, sizeof(*probe_ent)); | ||
894 | probe_ent->dev = pci_dev_to_dev(pdev); | 892 | probe_ent->dev = pci_dev_to_dev(pdev); |
895 | INIT_LIST_HEAD(&probe_ent->node); | 893 | INIT_LIST_HEAD(&probe_ent->node); |
896 | 894 | ||
@@ -907,7 +905,6 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
907 | probe_ent->mmio_base = port_base; | 905 | probe_ent->mmio_base = port_base; |
908 | probe_ent->private_data = hpriv; | 906 | probe_ent->private_data = hpriv; |
909 | 907 | ||
910 | memset(hpriv, 0, sizeof(*hpriv)); | ||
911 | hpriv->host_base = host_base; | 908 | hpriv->host_base = host_base; |
912 | hpriv->port_base = port_base; | 909 | hpriv->port_base = port_base; |
913 | 910 | ||
@@ -1011,9 +1008,9 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1011 | 1008 | ||
1012 | out_free: | 1009 | out_free: |
1013 | if (host_base) | 1010 | if (host_base) |
1014 | iounmap(host_base); | 1011 | pci_iounmap(pdev, host_base); |
1015 | if (port_base) | 1012 | if (port_base) |
1016 | iounmap(port_base); | 1013 | pci_iounmap(pdev, port_base); |
1017 | kfree(probe_ent); | 1014 | kfree(probe_ent); |
1018 | kfree(hpriv); | 1015 | kfree(hpriv); |
1019 | pci_release_regions(pdev); | 1016 | pci_release_regions(pdev); |