aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-device.c4
-rw-r--r--drivers/firewire/sbp2.c37
2 files changed, 23 insertions, 18 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 65d84dd6c1de..3f4e646367b7 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -93,7 +93,7 @@ static int fw_unit_match(struct device *dev, struct device_driver *drv)
93 if (!is_fw_unit(dev)) 93 if (!is_fw_unit(dev))
94 return 0; 94 return 0;
95 95
96 device = fw_device(unit->device.parent); 96 device = fw_parent_device(unit);
97 id = container_of(drv, struct fw_driver, driver)->id_table; 97 id = container_of(drv, struct fw_driver, driver)->id_table;
98 98
99 for (; id->match_flags != 0; id++) { 99 for (; id->match_flags != 0; id++) {
@@ -114,7 +114,7 @@ static int fw_unit_match(struct device *dev, struct device_driver *drv)
114 114
115static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) 115static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size)
116{ 116{
117 struct fw_device *device = fw_device(unit->device.parent); 117 struct fw_device *device = fw_parent_device(unit);
118 struct fw_csr_iterator ci; 118 struct fw_csr_iterator ci;
119 119
120 int key, value; 120 int key, value;
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index d41cb6e455bc..2353643721c1 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -180,6 +180,11 @@ struct sbp2_target {
180 int blocked; /* ditto */ 180 int blocked; /* ditto */
181}; 181};
182 182
183static struct fw_device *target_device(struct sbp2_target *tgt)
184{
185 return fw_parent_device(tgt->unit);
186}
187
183/* Impossible login_id, to detect logout attempt before successful login */ 188/* Impossible login_id, to detect logout attempt before successful login */
184#define INVALID_LOGIN_ID 0x10000 189#define INVALID_LOGIN_ID 0x10000
185 190
@@ -488,7 +493,7 @@ static void complete_transaction(struct fw_card *card, int rcode,
488static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, 493static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
489 int node_id, int generation, u64 offset) 494 int node_id, int generation, u64 offset)
490{ 495{
491 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 496 struct fw_device *device = target_device(lu->tgt);
492 unsigned long flags; 497 unsigned long flags;
493 498
494 orb->pointer.high = 0; 499 orb->pointer.high = 0;
@@ -510,7 +515,7 @@ static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
510 515
511static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu) 516static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
512{ 517{
513 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 518 struct fw_device *device = target_device(lu->tgt);
514 struct sbp2_orb *orb, *next; 519 struct sbp2_orb *orb, *next;
515 struct list_head list; 520 struct list_head list;
516 unsigned long flags; 521 unsigned long flags;
@@ -548,7 +553,7 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
548 int generation, int function, 553 int generation, int function,
549 int lun_or_login_id, void *response) 554 int lun_or_login_id, void *response)
550{ 555{
551 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 556 struct fw_device *device = target_device(lu->tgt);
552 struct sbp2_management_orb *orb; 557 struct sbp2_management_orb *orb;
553 unsigned int timeout; 558 unsigned int timeout;
554 int retval = -ENOMEM; 559 int retval = -ENOMEM;
@@ -644,7 +649,7 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
644 649
645static void sbp2_agent_reset(struct sbp2_logical_unit *lu) 650static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
646{ 651{
647 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 652 struct fw_device *device = target_device(lu->tgt);
648 __be32 d = 0; 653 __be32 d = 0;
649 654
650 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST, 655 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -661,7 +666,7 @@ static void complete_agent_reset_write_no_wait(struct fw_card *card,
661 666
662static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu) 667static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
663{ 668{
664 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 669 struct fw_device *device = target_device(lu->tgt);
665 struct fw_transaction *t; 670 struct fw_transaction *t;
666 static __be32 d; 671 static __be32 d;
667 672
@@ -700,7 +705,7 @@ static inline void sbp2_allow_block(struct sbp2_logical_unit *lu)
700static void sbp2_conditionally_block(struct sbp2_logical_unit *lu) 705static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
701{ 706{
702 struct sbp2_target *tgt = lu->tgt; 707 struct sbp2_target *tgt = lu->tgt;
703 struct fw_card *card = fw_device(tgt->unit->device.parent)->card; 708 struct fw_card *card = target_device(tgt)->card;
704 struct Scsi_Host *shost = 709 struct Scsi_Host *shost =
705 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 710 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
706 unsigned long flags; 711 unsigned long flags;
@@ -724,7 +729,7 @@ static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
724static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu) 729static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
725{ 730{
726 struct sbp2_target *tgt = lu->tgt; 731 struct sbp2_target *tgt = lu->tgt;
727 struct fw_card *card = fw_device(tgt->unit->device.parent)->card; 732 struct fw_card *card = target_device(tgt)->card;
728 struct Scsi_Host *shost = 733 struct Scsi_Host *shost =
729 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 734 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
730 unsigned long flags; 735 unsigned long flags;
@@ -749,7 +754,7 @@ static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
749 */ 754 */
750static void sbp2_unblock(struct sbp2_target *tgt) 755static void sbp2_unblock(struct sbp2_target *tgt)
751{ 756{
752 struct fw_card *card = fw_device(tgt->unit->device.parent)->card; 757 struct fw_card *card = target_device(tgt)->card;
753 struct Scsi_Host *shost = 758 struct Scsi_Host *shost =
754 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 759 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
755 unsigned long flags; 760 unsigned long flags;
@@ -779,7 +784,7 @@ static void sbp2_release_target(struct kref *kref)
779 struct Scsi_Host *shost = 784 struct Scsi_Host *shost =
780 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 785 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
781 struct scsi_device *sdev; 786 struct scsi_device *sdev;
782 struct fw_device *device = fw_device(tgt->unit->device.parent); 787 struct fw_device *device = target_device(tgt);
783 788
784 /* prevent deadlocks */ 789 /* prevent deadlocks */
785 sbp2_unblock(tgt); 790 sbp2_unblock(tgt);
@@ -852,7 +857,7 @@ static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
852 */ 857 */
853static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) 858static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
854{ 859{
855 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 860 struct fw_device *device = target_device(lu->tgt);
856 __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT); 861 __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT);
857 862
858 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST, 863 fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -868,7 +873,7 @@ static void sbp2_login(struct work_struct *work)
868 struct sbp2_logical_unit *lu = 873 struct sbp2_logical_unit *lu =
869 container_of(work, struct sbp2_logical_unit, work.work); 874 container_of(work, struct sbp2_logical_unit, work.work);
870 struct sbp2_target *tgt = lu->tgt; 875 struct sbp2_target *tgt = lu->tgt;
871 struct fw_device *device = fw_device(tgt->unit->device.parent); 876 struct fw_device *device = target_device(tgt);
872 struct Scsi_Host *shost; 877 struct Scsi_Host *shost;
873 struct scsi_device *sdev; 878 struct scsi_device *sdev;
874 struct sbp2_login_response response; 879 struct sbp2_login_response response;
@@ -1116,7 +1121,7 @@ static struct scsi_host_template scsi_driver_template;
1116static int sbp2_probe(struct device *dev) 1121static int sbp2_probe(struct device *dev)
1117{ 1122{
1118 struct fw_unit *unit = fw_unit(dev); 1123 struct fw_unit *unit = fw_unit(dev);
1119 struct fw_device *device = fw_device(unit->device.parent); 1124 struct fw_device *device = fw_parent_device(unit);
1120 struct sbp2_target *tgt; 1125 struct sbp2_target *tgt;
1121 struct sbp2_logical_unit *lu; 1126 struct sbp2_logical_unit *lu;
1122 struct Scsi_Host *shost; 1127 struct Scsi_Host *shost;
@@ -1197,7 +1202,7 @@ static void sbp2_reconnect(struct work_struct *work)
1197 struct sbp2_logical_unit *lu = 1202 struct sbp2_logical_unit *lu =
1198 container_of(work, struct sbp2_logical_unit, work.work); 1203 container_of(work, struct sbp2_logical_unit, work.work);
1199 struct sbp2_target *tgt = lu->tgt; 1204 struct sbp2_target *tgt = lu->tgt;
1200 struct fw_device *device = fw_device(tgt->unit->device.parent); 1205 struct fw_device *device = target_device(tgt);
1201 int generation, node_id, local_node_id; 1206 int generation, node_id, local_node_id;
1202 1207
1203 if (fw_device_is_shutdown(device)) 1208 if (fw_device_is_shutdown(device))
@@ -1249,7 +1254,7 @@ static void sbp2_update(struct fw_unit *unit)
1249 struct sbp2_target *tgt = unit->device.driver_data; 1254 struct sbp2_target *tgt = unit->device.driver_data;
1250 struct sbp2_logical_unit *lu; 1255 struct sbp2_logical_unit *lu;
1251 1256
1252 fw_device_enable_phys_dma(fw_device(unit->device.parent)); 1257 fw_device_enable_phys_dma(fw_parent_device(unit));
1253 1258
1254 /* 1259 /*
1255 * Fw-core serializes sbp2_update() against sbp2_remove(). 1260 * Fw-core serializes sbp2_update() against sbp2_remove().
@@ -1342,7 +1347,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
1342{ 1347{
1343 struct sbp2_command_orb *orb = 1348 struct sbp2_command_orb *orb =
1344 container_of(base_orb, struct sbp2_command_orb, base); 1349 container_of(base_orb, struct sbp2_command_orb, base);
1345 struct fw_device *device = fw_device(orb->lu->tgt->unit->device.parent); 1350 struct fw_device *device = target_device(orb->lu->tgt);
1346 int result; 1351 int result;
1347 1352
1348 if (status != NULL) { 1353 if (status != NULL) {
@@ -1449,7 +1454,7 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
1449static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) 1454static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1450{ 1455{
1451 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1456 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1452 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 1457 struct fw_device *device = target_device(lu->tgt);
1453 struct sbp2_command_orb *orb; 1458 struct sbp2_command_orb *orb;
1454 int generation, retval = SCSI_MLQUEUE_HOST_BUSY; 1459 int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
1455 1460