diff options
author | Tejun Heo <htejun@gmail.com> | 2007-01-20 02:00:28 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:37 -0500 |
commit | 24dc5f33ea4b504cfbd23fa159a4cacba8e4d800 (patch) | |
tree | d76de456157f555c9a65b83f426fd805fee1e846 /drivers/ata/ata_piix.c | |
parent | f0d36efdc624beb3d9e29b9ab9e9537bf0f25d5b (diff) |
libata: update libata LLDs to use devres
Update libata LLDs to use devres. Core layer is already converted to
support managed LLDs. This patch simplifies initialization and fixes
many resource related bugs in init failure and detach path. For
example, all converted drivers now handle ata_device_add() failure
gracefully without excessive resource rollback code.
As most resources are released automatically on driver detach, many
drivers don't need or can do with much simpler ->{port|host}_stop().
In general, stop callbacks are need iff port or host needs to be given
commands to shut it down. Note that freezing is enough in many cases
and ports are automatically frozen before being detached.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ata_piix.c')
-rw-r--r-- | drivers/ata/ata_piix.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index f15ef88ba00c..c6bf1a338d1a 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -154,7 +154,6 @@ struct piix_host_priv { | |||
154 | 154 | ||
155 | static int piix_init_one (struct pci_dev *pdev, | 155 | static int piix_init_one (struct pci_dev *pdev, |
156 | const struct pci_device_id *ent); | 156 | const struct pci_device_id *ent); |
157 | static void piix_host_stop(struct ata_host *host); | ||
158 | static void piix_pata_error_handler(struct ata_port *ap); | 157 | static void piix_pata_error_handler(struct ata_port *ap); |
159 | static void ich_pata_error_handler(struct ata_port *ap); | 158 | static void ich_pata_error_handler(struct ata_port *ap); |
160 | static void piix_sata_error_handler(struct ata_port *ap); | 159 | static void piix_sata_error_handler(struct ata_port *ap); |
@@ -311,8 +310,6 @@ static const struct ata_port_operations piix_pata_ops = { | |||
311 | .irq_clear = ata_bmdma_irq_clear, | 310 | .irq_clear = ata_bmdma_irq_clear, |
312 | 311 | ||
313 | .port_start = ata_port_start, | 312 | .port_start = ata_port_start, |
314 | .port_stop = ata_port_stop, | ||
315 | .host_stop = piix_host_stop, | ||
316 | }; | 313 | }; |
317 | 314 | ||
318 | static const struct ata_port_operations ich_pata_ops = { | 315 | static const struct ata_port_operations ich_pata_ops = { |
@@ -344,8 +341,6 @@ static const struct ata_port_operations ich_pata_ops = { | |||
344 | .irq_clear = ata_bmdma_irq_clear, | 341 | .irq_clear = ata_bmdma_irq_clear, |
345 | 342 | ||
346 | .port_start = ata_port_start, | 343 | .port_start = ata_port_start, |
347 | .port_stop = ata_port_stop, | ||
348 | .host_stop = piix_host_stop, | ||
349 | }; | 344 | }; |
350 | 345 | ||
351 | static const struct ata_port_operations piix_sata_ops = { | 346 | static const struct ata_port_operations piix_sata_ops = { |
@@ -374,8 +369,6 @@ static const struct ata_port_operations piix_sata_ops = { | |||
374 | .irq_clear = ata_bmdma_irq_clear, | 369 | .irq_clear = ata_bmdma_irq_clear, |
375 | 370 | ||
376 | .port_start = ata_port_start, | 371 | .port_start = ata_port_start, |
377 | .port_stop = ata_port_stop, | ||
378 | .host_stop = piix_host_stop, | ||
379 | }; | 372 | }; |
380 | 373 | ||
381 | static const struct piix_map_db ich5_map_db = { | 374 | static const struct piix_map_db ich5_map_db = { |
@@ -1072,6 +1065,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
1072 | static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 1065 | static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
1073 | { | 1066 | { |
1074 | static int printed_version; | 1067 | static int printed_version; |
1068 | struct device *dev = &pdev->dev; | ||
1075 | struct ata_port_info port_info[2]; | 1069 | struct ata_port_info port_info[2]; |
1076 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; | 1070 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; |
1077 | struct piix_host_priv *hpriv; | 1071 | struct piix_host_priv *hpriv; |
@@ -1085,7 +1079,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1085 | if (!in_module_init) | 1079 | if (!in_module_init) |
1086 | return -ENODEV; | 1080 | return -ENODEV; |
1087 | 1081 | ||
1088 | hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); | 1082 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); |
1089 | if (!hpriv) | 1083 | if (!hpriv) |
1090 | return -ENOMEM; | 1084 | return -ENOMEM; |
1091 | 1085 | ||
@@ -1135,15 +1129,6 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1135 | return ata_pci_init_one(pdev, ppinfo, 2); | 1129 | return ata_pci_init_one(pdev, ppinfo, 2); |
1136 | } | 1130 | } |
1137 | 1131 | ||
1138 | static void piix_host_stop(struct ata_host *host) | ||
1139 | { | ||
1140 | struct piix_host_priv *hpriv = host->private_data; | ||
1141 | |||
1142 | ata_host_stop(host); | ||
1143 | |||
1144 | kfree(hpriv); | ||
1145 | } | ||
1146 | |||
1147 | static int __init piix_init(void) | 1132 | static int __init piix_init(void) |
1148 | { | 1133 | { |
1149 | int rc; | 1134 | int rc; |