diff options
author | Yijing Wang <wangyijing@huawei.com> | 2015-06-19 03:57:44 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-07-15 23:03:31 -0400 |
commit | a6ed1f4e94e1883742ac79f09f9754ffacfae456 (patch) | |
tree | a57ececbdfe726f12bd4a4152e986a26ca71a10c | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) |
PCI: Use "slot" and "pci_slot" for struct hotplug_slot and struct pci_slot
Now in pci_hotplug_core.c, we randomly name a struct hotplug_slot and a
struct pci_slot. It's easy to confuse them, so let us use "slot" for a
struct hotplug_slot and "pci_slot" for a struct pci_slot.
No functional change.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 56d8486dc167..d1fab97d6b01 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -83,12 +83,12 @@ GET_STATUS(attention_status, u8) | |||
83 | GET_STATUS(latch_status, u8) | 83 | GET_STATUS(latch_status, u8) |
84 | GET_STATUS(adapter_status, u8) | 84 | GET_STATUS(adapter_status, u8) |
85 | 85 | ||
86 | static ssize_t power_read_file(struct pci_slot *slot, char *buf) | 86 | static ssize_t power_read_file(struct pci_slot *pci_slot, char *buf) |
87 | { | 87 | { |
88 | int retval; | 88 | int retval; |
89 | u8 value; | 89 | u8 value; |
90 | 90 | ||
91 | retval = get_power_status(slot->hotplug, &value); | 91 | retval = get_power_status(pci_slot->hotplug, &value); |
92 | if (retval) | 92 | if (retval) |
93 | return retval; | 93 | return retval; |
94 | 94 | ||
@@ -140,22 +140,22 @@ static struct pci_slot_attribute hotplug_slot_attr_power = { | |||
140 | .store = power_write_file | 140 | .store = power_write_file |
141 | }; | 141 | }; |
142 | 142 | ||
143 | static ssize_t attention_read_file(struct pci_slot *slot, char *buf) | 143 | static ssize_t attention_read_file(struct pci_slot *pci_slot, char *buf) |
144 | { | 144 | { |
145 | int retval; | 145 | int retval; |
146 | u8 value; | 146 | u8 value; |
147 | 147 | ||
148 | retval = get_attention_status(slot->hotplug, &value); | 148 | retval = get_attention_status(pci_slot->hotplug, &value); |
149 | if (retval) | 149 | if (retval) |
150 | return retval; | 150 | return retval; |
151 | 151 | ||
152 | return sprintf(buf, "%d\n", value); | 152 | return sprintf(buf, "%d\n", value); |
153 | } | 153 | } |
154 | 154 | ||
155 | static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, | 155 | static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, |
156 | size_t count) | 156 | size_t count) |
157 | { | 157 | { |
158 | struct hotplug_slot_ops *ops = slot->hotplug->ops; | 158 | struct hotplug_slot_ops *ops = pci_slot->hotplug->ops; |
159 | unsigned long lattention; | 159 | unsigned long lattention; |
160 | u8 attention; | 160 | u8 attention; |
161 | int retval = 0; | 161 | int retval = 0; |
@@ -169,7 +169,7 @@ static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, | |||
169 | goto exit; | 169 | goto exit; |
170 | } | 170 | } |
171 | if (ops->set_attention_status) | 171 | if (ops->set_attention_status) |
172 | retval = ops->set_attention_status(slot->hotplug, attention); | 172 | retval = ops->set_attention_status(pci_slot->hotplug, attention); |
173 | module_put(ops->owner); | 173 | module_put(ops->owner); |
174 | 174 | ||
175 | exit: | 175 | exit: |
@@ -184,12 +184,12 @@ static struct pci_slot_attribute hotplug_slot_attr_attention = { | |||
184 | .store = attention_write_file | 184 | .store = attention_write_file |
185 | }; | 185 | }; |
186 | 186 | ||
187 | static ssize_t latch_read_file(struct pci_slot *slot, char *buf) | 187 | static ssize_t latch_read_file(struct pci_slot *pci_slot, char *buf) |
188 | { | 188 | { |
189 | int retval; | 189 | int retval; |
190 | u8 value; | 190 | u8 value; |
191 | 191 | ||
192 | retval = get_latch_status(slot->hotplug, &value); | 192 | retval = get_latch_status(pci_slot->hotplug, &value); |
193 | if (retval) | 193 | if (retval) |
194 | return retval; | 194 | return retval; |
195 | 195 | ||
@@ -201,12 +201,12 @@ static struct pci_slot_attribute hotplug_slot_attr_latch = { | |||
201 | .show = latch_read_file, | 201 | .show = latch_read_file, |
202 | }; | 202 | }; |
203 | 203 | ||
204 | static ssize_t presence_read_file(struct pci_slot *slot, char *buf) | 204 | static ssize_t presence_read_file(struct pci_slot *pci_slot, char *buf) |
205 | { | 205 | { |
206 | int retval; | 206 | int retval; |
207 | u8 value; | 207 | u8 value; |
208 | 208 | ||
209 | retval = get_adapter_status(slot->hotplug, &value); | 209 | retval = get_adapter_status(pci_slot->hotplug, &value); |
210 | if (retval) | 210 | if (retval) |
211 | return retval; | 211 | return retval; |
212 | 212 | ||
@@ -307,43 +307,43 @@ static bool has_test_file(struct pci_slot *pci_slot) | |||
307 | return false; | 307 | return false; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int fs_add_slot(struct pci_slot *slot) | 310 | static int fs_add_slot(struct pci_slot *pci_slot) |
311 | { | 311 | { |
312 | int retval = 0; | 312 | int retval = 0; |
313 | 313 | ||
314 | /* Create symbolic link to the hotplug driver module */ | 314 | /* Create symbolic link to the hotplug driver module */ |
315 | pci_hp_create_module_link(slot); | 315 | pci_hp_create_module_link(pci_slot); |
316 | 316 | ||
317 | if (has_power_file(slot)) { | 317 | if (has_power_file(pci_slot)) { |
318 | retval = sysfs_create_file(&slot->kobj, | 318 | retval = sysfs_create_file(&pci_slot->kobj, |
319 | &hotplug_slot_attr_power.attr); | 319 | &hotplug_slot_attr_power.attr); |
320 | if (retval) | 320 | if (retval) |
321 | goto exit_power; | 321 | goto exit_power; |
322 | } | 322 | } |
323 | 323 | ||
324 | if (has_attention_file(slot)) { | 324 | if (has_attention_file(pci_slot)) { |
325 | retval = sysfs_create_file(&slot->kobj, | 325 | retval = sysfs_create_file(&pci_slot->kobj, |
326 | &hotplug_slot_attr_attention.attr); | 326 | &hotplug_slot_attr_attention.attr); |
327 | if (retval) | 327 | if (retval) |
328 | goto exit_attention; | 328 | goto exit_attention; |
329 | } | 329 | } |
330 | 330 | ||
331 | if (has_latch_file(slot)) { | 331 | if (has_latch_file(pci_slot)) { |
332 | retval = sysfs_create_file(&slot->kobj, | 332 | retval = sysfs_create_file(&pci_slot->kobj, |
333 | &hotplug_slot_attr_latch.attr); | 333 | &hotplug_slot_attr_latch.attr); |
334 | if (retval) | 334 | if (retval) |
335 | goto exit_latch; | 335 | goto exit_latch; |
336 | } | 336 | } |
337 | 337 | ||
338 | if (has_adapter_file(slot)) { | 338 | if (has_adapter_file(pci_slot)) { |
339 | retval = sysfs_create_file(&slot->kobj, | 339 | retval = sysfs_create_file(&pci_slot->kobj, |
340 | &hotplug_slot_attr_presence.attr); | 340 | &hotplug_slot_attr_presence.attr); |
341 | if (retval) | 341 | if (retval) |
342 | goto exit_adapter; | 342 | goto exit_adapter; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (has_test_file(slot)) { | 345 | if (has_test_file(pci_slot)) { |
346 | retval = sysfs_create_file(&slot->kobj, | 346 | retval = sysfs_create_file(&pci_slot->kobj, |
347 | &hotplug_slot_attr_test.attr); | 347 | &hotplug_slot_attr_test.attr); |
348 | if (retval) | 348 | if (retval) |
349 | goto exit_test; | 349 | goto exit_test; |
@@ -352,45 +352,45 @@ static int fs_add_slot(struct pci_slot *slot) | |||
352 | goto exit; | 352 | goto exit; |
353 | 353 | ||
354 | exit_test: | 354 | exit_test: |
355 | if (has_adapter_file(slot)) | 355 | if (has_adapter_file(pci_slot)) |
356 | sysfs_remove_file(&slot->kobj, | 356 | sysfs_remove_file(&pci_slot->kobj, |
357 | &hotplug_slot_attr_presence.attr); | 357 | &hotplug_slot_attr_presence.attr); |
358 | exit_adapter: | 358 | exit_adapter: |
359 | if (has_latch_file(slot)) | 359 | if (has_latch_file(pci_slot)) |
360 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr); | 360 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_latch.attr); |
361 | exit_latch: | 361 | exit_latch: |
362 | if (has_attention_file(slot)) | 362 | if (has_attention_file(pci_slot)) |
363 | sysfs_remove_file(&slot->kobj, | 363 | sysfs_remove_file(&pci_slot->kobj, |
364 | &hotplug_slot_attr_attention.attr); | 364 | &hotplug_slot_attr_attention.attr); |
365 | exit_attention: | 365 | exit_attention: |
366 | if (has_power_file(slot)) | 366 | if (has_power_file(pci_slot)) |
367 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr); | 367 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_power.attr); |
368 | exit_power: | 368 | exit_power: |
369 | pci_hp_remove_module_link(slot); | 369 | pci_hp_remove_module_link(pci_slot); |
370 | exit: | 370 | exit: |
371 | return retval; | 371 | return retval; |
372 | } | 372 | } |
373 | 373 | ||
374 | static void fs_remove_slot(struct pci_slot *slot) | 374 | static void fs_remove_slot(struct pci_slot *pci_slot) |
375 | { | 375 | { |
376 | if (has_power_file(slot)) | 376 | if (has_power_file(pci_slot)) |
377 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr); | 377 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_power.attr); |
378 | 378 | ||
379 | if (has_attention_file(slot)) | 379 | if (has_attention_file(pci_slot)) |
380 | sysfs_remove_file(&slot->kobj, | 380 | sysfs_remove_file(&pci_slot->kobj, |
381 | &hotplug_slot_attr_attention.attr); | 381 | &hotplug_slot_attr_attention.attr); |
382 | 382 | ||
383 | if (has_latch_file(slot)) | 383 | if (has_latch_file(pci_slot)) |
384 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr); | 384 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_latch.attr); |
385 | 385 | ||
386 | if (has_adapter_file(slot)) | 386 | if (has_adapter_file(pci_slot)) |
387 | sysfs_remove_file(&slot->kobj, | 387 | sysfs_remove_file(&pci_slot->kobj, |
388 | &hotplug_slot_attr_presence.attr); | 388 | &hotplug_slot_attr_presence.attr); |
389 | 389 | ||
390 | if (has_test_file(slot)) | 390 | if (has_test_file(pci_slot)) |
391 | sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr); | 391 | sysfs_remove_file(&pci_slot->kobj, &hotplug_slot_attr_test.attr); |
392 | 392 | ||
393 | pci_hp_remove_module_link(slot); | 393 | pci_hp_remove_module_link(pci_slot); |
394 | } | 394 | } |
395 | 395 | ||
396 | static struct hotplug_slot *get_slot_from_name(const char *name) | 396 | static struct hotplug_slot *get_slot_from_name(const char *name) |
@@ -467,37 +467,37 @@ EXPORT_SYMBOL_GPL(__pci_hp_register); | |||
467 | 467 | ||
468 | /** | 468 | /** |
469 | * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem | 469 | * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem |
470 | * @hotplug: pointer to the &struct hotplug_slot to deregister | 470 | * @slot: pointer to the &struct hotplug_slot to deregister |
471 | * | 471 | * |
472 | * The @slot must have been registered with the pci hotplug subsystem | 472 | * The @slot must have been registered with the pci hotplug subsystem |
473 | * previously with a call to pci_hp_register(). | 473 | * previously with a call to pci_hp_register(). |
474 | * | 474 | * |
475 | * Returns 0 if successful, anything else for an error. | 475 | * Returns 0 if successful, anything else for an error. |
476 | */ | 476 | */ |
477 | int pci_hp_deregister(struct hotplug_slot *hotplug) | 477 | int pci_hp_deregister(struct hotplug_slot *slot) |
478 | { | 478 | { |
479 | struct hotplug_slot *temp; | 479 | struct hotplug_slot *temp; |
480 | struct pci_slot *slot; | 480 | struct pci_slot *pci_slot; |
481 | 481 | ||
482 | if (!hotplug) | 482 | if (!slot) |
483 | return -ENODEV; | 483 | return -ENODEV; |
484 | 484 | ||
485 | mutex_lock(&pci_hp_mutex); | 485 | mutex_lock(&pci_hp_mutex); |
486 | temp = get_slot_from_name(hotplug_slot_name(hotplug)); | 486 | temp = get_slot_from_name(hotplug_slot_name(slot)); |
487 | if (temp != hotplug) { | 487 | if (temp != slot) { |
488 | mutex_unlock(&pci_hp_mutex); | 488 | mutex_unlock(&pci_hp_mutex); |
489 | return -ENODEV; | 489 | return -ENODEV; |
490 | } | 490 | } |
491 | 491 | ||
492 | list_del(&hotplug->slot_list); | 492 | list_del(&slot->slot_list); |
493 | 493 | ||
494 | slot = hotplug->pci_slot; | 494 | pci_slot = slot->pci_slot; |
495 | fs_remove_slot(slot); | 495 | fs_remove_slot(pci_slot); |
496 | dbg("Removed slot %s from the list\n", hotplug_slot_name(hotplug)); | 496 | dbg("Removed slot %s from the list\n", hotplug_slot_name(slot)); |
497 | 497 | ||
498 | hotplug->release(hotplug); | 498 | slot->release(slot); |
499 | slot->hotplug = NULL; | 499 | pci_slot->hotplug = NULL; |
500 | pci_destroy_slot(slot); | 500 | pci_destroy_slot(pci_slot); |
501 | mutex_unlock(&pci_hp_mutex); | 501 | mutex_unlock(&pci_hp_mutex); |
502 | 502 | ||
503 | return 0; | 503 | return 0; |
@@ -506,7 +506,7 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister); | |||
506 | 506 | ||
507 | /** | 507 | /** |
508 | * pci_hp_change_slot_info - changes the slot's information structure in the core | 508 | * pci_hp_change_slot_info - changes the slot's information structure in the core |
509 | * @hotplug: pointer to the slot whose info has changed | 509 | * @slot: pointer to the slot whose info has changed |
510 | * @info: pointer to the info copy into the slot's info structure | 510 | * @info: pointer to the info copy into the slot's info structure |
511 | * | 511 | * |
512 | * @slot must have been registered with the pci | 512 | * @slot must have been registered with the pci |
@@ -514,13 +514,13 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister); | |||
514 | * | 514 | * |
515 | * Returns 0 if successful, anything else for an error. | 515 | * Returns 0 if successful, anything else for an error. |
516 | */ | 516 | */ |
517 | int pci_hp_change_slot_info(struct hotplug_slot *hotplug, | 517 | int pci_hp_change_slot_info(struct hotplug_slot *slot, |
518 | struct hotplug_slot_info *info) | 518 | struct hotplug_slot_info *info) |
519 | { | 519 | { |
520 | if (!hotplug || !info) | 520 | if (!slot || !info) |
521 | return -ENODEV; | 521 | return -ENODEV; |
522 | 522 | ||
523 | memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info)); | 523 | memcpy(slot->info, info, sizeof(struct hotplug_slot_info)); |
524 | 524 | ||
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |