diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-18 18:00:43 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-04-18 18:00:43 -0400 |
commit | fc38b521dcffcb07447cd98fedc56f495c10b90d (patch) | |
tree | cc0fdc986970179c95612f8d3dc9c06c78fa6d53 /drivers | |
parent | 5c4be57249e2e09136446597d2fe2a967c6ffef0 (diff) |
ide-pm: don't abuse rq->data
Impact: cleanup rq->data usage
ide-pm uses rq->data to carry pointer to struct request_pm_state
through request queue and rq->special is used to carray pointer to
local struct ide_cmd, which isn't necessary. Use rq->special for
request_pm_state instead and use local ide_cmd in
ide_start_power_step().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-io.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-pm.c | 38 |
2 files changed, 16 insertions, 24 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 3245c2dbda33..6e3094e22775 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -368,7 +368,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
368 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 368 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
369 | return execute_drive_cmd(drive, rq); | 369 | return execute_drive_cmd(drive, rq); |
370 | else if (blk_pm_request(rq)) { | 370 | else if (blk_pm_request(rq)) { |
371 | struct request_pm_state *pm = rq->data; | 371 | struct request_pm_state *pm = rq->special; |
372 | #ifdef DEBUG_PM | 372 | #ifdef DEBUG_PM |
373 | printk("%s: start_power_step(step: %d)\n", | 373 | printk("%s: start_power_step(step: %d)\n", |
374 | drive->name, pm->pm_step); | 374 | drive->name, pm->pm_step); |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 0d8a151c0a01..ba1488bd8430 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -7,7 +7,6 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
7 | ide_hwif_t *hwif = drive->hwif; | 7 | ide_hwif_t *hwif = drive->hwif; |
8 | struct request *rq; | 8 | struct request *rq; |
9 | struct request_pm_state rqpm; | 9 | struct request_pm_state rqpm; |
10 | struct ide_cmd cmd; | ||
11 | int ret; | 10 | int ret; |
12 | 11 | ||
13 | /* call ACPI _GTM only once */ | 12 | /* call ACPI _GTM only once */ |
@@ -15,11 +14,9 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
15 | ide_acpi_get_timing(hwif); | 14 | ide_acpi_get_timing(hwif); |
16 | 15 | ||
17 | memset(&rqpm, 0, sizeof(rqpm)); | 16 | memset(&rqpm, 0, sizeof(rqpm)); |
18 | memset(&cmd, 0, sizeof(cmd)); | ||
19 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 17 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
20 | rq->cmd_type = REQ_TYPE_PM_SUSPEND; | 18 | rq->cmd_type = REQ_TYPE_PM_SUSPEND; |
21 | rq->special = &cmd; | 19 | rq->special = &rqpm; |
22 | rq->data = &rqpm; | ||
23 | rqpm.pm_step = IDE_PM_START_SUSPEND; | 20 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
24 | if (mesg.event == PM_EVENT_PRETHAW) | 21 | if (mesg.event == PM_EVENT_PRETHAW) |
25 | mesg.event = PM_EVENT_FREEZE; | 22 | mesg.event = PM_EVENT_FREEZE; |
@@ -41,7 +38,6 @@ int generic_ide_resume(struct device *dev) | |||
41 | ide_hwif_t *hwif = drive->hwif; | 38 | ide_hwif_t *hwif = drive->hwif; |
42 | struct request *rq; | 39 | struct request *rq; |
43 | struct request_pm_state rqpm; | 40 | struct request_pm_state rqpm; |
44 | struct ide_cmd cmd; | ||
45 | int err; | 41 | int err; |
46 | 42 | ||
47 | /* call ACPI _PS0 / _STM only once */ | 43 | /* call ACPI _PS0 / _STM only once */ |
@@ -53,12 +49,10 @@ int generic_ide_resume(struct device *dev) | |||
53 | ide_acpi_exec_tfs(drive); | 49 | ide_acpi_exec_tfs(drive); |
54 | 50 | ||
55 | memset(&rqpm, 0, sizeof(rqpm)); | 51 | memset(&rqpm, 0, sizeof(rqpm)); |
56 | memset(&cmd, 0, sizeof(cmd)); | ||
57 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 52 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
58 | rq->cmd_type = REQ_TYPE_PM_RESUME; | 53 | rq->cmd_type = REQ_TYPE_PM_RESUME; |
59 | rq->cmd_flags |= REQ_PREEMPT; | 54 | rq->cmd_flags |= REQ_PREEMPT; |
60 | rq->special = &cmd; | 55 | rq->special = &rqpm; |
61 | rq->data = &rqpm; | ||
62 | rqpm.pm_step = IDE_PM_START_RESUME; | 56 | rqpm.pm_step = IDE_PM_START_RESUME; |
63 | rqpm.pm_state = PM_EVENT_ON; | 57 | rqpm.pm_state = PM_EVENT_ON; |
64 | 58 | ||
@@ -77,7 +71,7 @@ int generic_ide_resume(struct device *dev) | |||
77 | 71 | ||
78 | void ide_complete_power_step(ide_drive_t *drive, struct request *rq) | 72 | void ide_complete_power_step(ide_drive_t *drive, struct request *rq) |
79 | { | 73 | { |
80 | struct request_pm_state *pm = rq->data; | 74 | struct request_pm_state *pm = rq->special; |
81 | 75 | ||
82 | #ifdef DEBUG_PM | 76 | #ifdef DEBUG_PM |
83 | printk(KERN_INFO "%s: complete_power_step(step: %d)\n", | 77 | printk(KERN_INFO "%s: complete_power_step(step: %d)\n", |
@@ -107,10 +101,8 @@ void ide_complete_power_step(ide_drive_t *drive, struct request *rq) | |||
107 | 101 | ||
108 | ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | 102 | ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) |
109 | { | 103 | { |
110 | struct request_pm_state *pm = rq->data; | 104 | struct request_pm_state *pm = rq->special; |
111 | struct ide_cmd *cmd = rq->special; | 105 | struct ide_cmd cmd = { }; |
112 | |||
113 | memset(cmd, 0, sizeof(*cmd)); | ||
114 | 106 | ||
115 | switch (pm->pm_step) { | 107 | switch (pm->pm_step) { |
116 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ | 108 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ |
@@ -123,12 +115,12 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
123 | return ide_stopped; | 115 | return ide_stopped; |
124 | } | 116 | } |
125 | if (ata_id_flush_ext_enabled(drive->id)) | 117 | if (ata_id_flush_ext_enabled(drive->id)) |
126 | cmd->tf.command = ATA_CMD_FLUSH_EXT; | 118 | cmd.tf.command = ATA_CMD_FLUSH_EXT; |
127 | else | 119 | else |
128 | cmd->tf.command = ATA_CMD_FLUSH; | 120 | cmd.tf.command = ATA_CMD_FLUSH; |
129 | goto out_do_tf; | 121 | goto out_do_tf; |
130 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ | 122 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ |
131 | cmd->tf.command = ATA_CMD_STANDBYNOW1; | 123 | cmd.tf.command = ATA_CMD_STANDBYNOW1; |
132 | goto out_do_tf; | 124 | goto out_do_tf; |
133 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ | 125 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ |
134 | ide_set_max_pio(drive); | 126 | ide_set_max_pio(drive); |
@@ -141,7 +133,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
141 | ide_complete_power_step(drive, rq); | 133 | ide_complete_power_step(drive, rq); |
142 | return ide_stopped; | 134 | return ide_stopped; |
143 | case IDE_PM_IDLE: /* Resume step 2 (idle) */ | 135 | case IDE_PM_IDLE: /* Resume step 2 (idle) */ |
144 | cmd->tf.command = ATA_CMD_IDLEIMMEDIATE; | 136 | cmd.tf.command = ATA_CMD_IDLEIMMEDIATE; |
145 | goto out_do_tf; | 137 | goto out_do_tf; |
146 | case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ | 138 | case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ |
147 | /* | 139 | /* |
@@ -163,11 +155,11 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
163 | return ide_stopped; | 155 | return ide_stopped; |
164 | 156 | ||
165 | out_do_tf: | 157 | out_do_tf: |
166 | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; | 158 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
167 | cmd->valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | 159 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; |
168 | cmd->protocol = ATA_PROT_NODATA; | 160 | cmd.protocol = ATA_PROT_NODATA; |
169 | 161 | ||
170 | return do_rw_taskfile(drive, cmd); | 162 | return do_rw_taskfile(drive, &cmd); |
171 | } | 163 | } |
172 | 164 | ||
173 | /** | 165 | /** |
@@ -181,7 +173,7 @@ out_do_tf: | |||
181 | void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) | 173 | void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) |
182 | { | 174 | { |
183 | struct request_queue *q = drive->queue; | 175 | struct request_queue *q = drive->queue; |
184 | struct request_pm_state *pm = rq->data; | 176 | struct request_pm_state *pm = rq->special; |
185 | unsigned long flags; | 177 | unsigned long flags; |
186 | 178 | ||
187 | ide_complete_power_step(drive, rq); | 179 | ide_complete_power_step(drive, rq); |
@@ -207,7 +199,7 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) | |||
207 | 199 | ||
208 | void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | 200 | void ide_check_pm_state(ide_drive_t *drive, struct request *rq) |
209 | { | 201 | { |
210 | struct request_pm_state *pm = rq->data; | 202 | struct request_pm_state *pm = rq->special; |
211 | 203 | ||
212 | if (blk_pm_suspend_request(rq) && | 204 | if (blk_pm_suspend_request(rq) && |
213 | pm->pm_step == IDE_PM_START_SUSPEND) | 205 | pm->pm_step == IDE_PM_START_SUSPEND) |