diff options
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_discover.c | 22 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_event.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_init.c | 6 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_internal.h | 12 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_phy.c | 45 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_port.c | 30 |
6 files changed, 81 insertions, 48 deletions
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index d977bd492d8d..fb7df7b75811 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
@@ -647,10 +647,12 @@ void sas_unregister_domain_devices(struct asd_sas_port *port) | |||
647 | * Discover process only interrogates devices in order to discover the | 647 | * Discover process only interrogates devices in order to discover the |
648 | * domain. | 648 | * domain. |
649 | */ | 649 | */ |
650 | static void sas_discover_domain(void *data) | 650 | static void sas_discover_domain(struct work_struct *work) |
651 | { | 651 | { |
652 | int error = 0; | 652 | int error = 0; |
653 | struct asd_sas_port *port = data; | 653 | struct sas_discovery_event *ev = |
654 | container_of(work, struct sas_discovery_event, work); | ||
655 | struct asd_sas_port *port = ev->port; | ||
654 | 656 | ||
655 | sas_begin_event(DISCE_DISCOVER_DOMAIN, &port->disc.disc_event_lock, | 657 | sas_begin_event(DISCE_DISCOVER_DOMAIN, &port->disc.disc_event_lock, |
656 | &port->disc.pending); | 658 | &port->disc.pending); |
@@ -692,10 +694,12 @@ static void sas_discover_domain(void *data) | |||
692 | current->pid, error); | 694 | current->pid, error); |
693 | } | 695 | } |
694 | 696 | ||
695 | static void sas_revalidate_domain(void *data) | 697 | static void sas_revalidate_domain(struct work_struct *work) |
696 | { | 698 | { |
697 | int res = 0; | 699 | int res = 0; |
698 | struct asd_sas_port *port = data; | 700 | struct sas_discovery_event *ev = |
701 | container_of(work, struct sas_discovery_event, work); | ||
702 | struct asd_sas_port *port = ev->port; | ||
699 | 703 | ||
700 | sas_begin_event(DISCE_REVALIDATE_DOMAIN, &port->disc.disc_event_lock, | 704 | sas_begin_event(DISCE_REVALIDATE_DOMAIN, &port->disc.disc_event_lock, |
701 | &port->disc.pending); | 705 | &port->disc.pending); |
@@ -722,7 +726,7 @@ int sas_discover_event(struct asd_sas_port *port, enum discover_event ev) | |||
722 | BUG_ON(ev >= DISC_NUM_EVENTS); | 726 | BUG_ON(ev >= DISC_NUM_EVENTS); |
723 | 727 | ||
724 | sas_queue_event(ev, &disc->disc_event_lock, &disc->pending, | 728 | sas_queue_event(ev, &disc->disc_event_lock, &disc->pending, |
725 | &disc->disc_work[ev], port->ha->core.shost); | 729 | &disc->disc_work[ev].work, port->ha->core.shost); |
726 | 730 | ||
727 | return 0; | 731 | return 0; |
728 | } | 732 | } |
@@ -737,13 +741,15 @@ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port) | |||
737 | { | 741 | { |
738 | int i; | 742 | int i; |
739 | 743 | ||
740 | static void (*sas_event_fns[DISC_NUM_EVENTS])(void *) = { | 744 | static const work_func_t sas_event_fns[DISC_NUM_EVENTS] = { |
741 | [DISCE_DISCOVER_DOMAIN] = sas_discover_domain, | 745 | [DISCE_DISCOVER_DOMAIN] = sas_discover_domain, |
742 | [DISCE_REVALIDATE_DOMAIN] = sas_revalidate_domain, | 746 | [DISCE_REVALIDATE_DOMAIN] = sas_revalidate_domain, |
743 | }; | 747 | }; |
744 | 748 | ||
745 | spin_lock_init(&disc->disc_event_lock); | 749 | spin_lock_init(&disc->disc_event_lock); |
746 | disc->pending = 0; | 750 | disc->pending = 0; |
747 | for (i = 0; i < DISC_NUM_EVENTS; i++) | 751 | for (i = 0; i < DISC_NUM_EVENTS; i++) { |
748 | INIT_WORK(&disc->disc_work[i], sas_event_fns[i], port); | 752 | INIT_WORK(&disc->disc_work[i].work, sas_event_fns[i]); |
753 | disc->disc_work[i].port = port; | ||
754 | } | ||
749 | } | 755 | } |
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 19110ed1c89c..d83392ee6823 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c | |||
@@ -31,7 +31,7 @@ static void notify_ha_event(struct sas_ha_struct *sas_ha, enum ha_event event) | |||
31 | BUG_ON(event >= HA_NUM_EVENTS); | 31 | BUG_ON(event >= HA_NUM_EVENTS); |
32 | 32 | ||
33 | sas_queue_event(event, &sas_ha->event_lock, &sas_ha->pending, | 33 | sas_queue_event(event, &sas_ha->event_lock, &sas_ha->pending, |
34 | &sas_ha->ha_events[event], sas_ha->core.shost); | 34 | &sas_ha->ha_events[event].work, sas_ha->core.shost); |
35 | } | 35 | } |
36 | 36 | ||
37 | static void notify_port_event(struct asd_sas_phy *phy, enum port_event event) | 37 | static void notify_port_event(struct asd_sas_phy *phy, enum port_event event) |
@@ -41,7 +41,7 @@ static void notify_port_event(struct asd_sas_phy *phy, enum port_event event) | |||
41 | BUG_ON(event >= PORT_NUM_EVENTS); | 41 | BUG_ON(event >= PORT_NUM_EVENTS); |
42 | 42 | ||
43 | sas_queue_event(event, &ha->event_lock, &phy->port_events_pending, | 43 | sas_queue_event(event, &ha->event_lock, &phy->port_events_pending, |
44 | &phy->port_events[event], ha->core.shost); | 44 | &phy->port_events[event].work, ha->core.shost); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) | 47 | static void notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) |
@@ -51,12 +51,12 @@ static void notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) | |||
51 | BUG_ON(event >= PHY_NUM_EVENTS); | 51 | BUG_ON(event >= PHY_NUM_EVENTS); |
52 | 52 | ||
53 | sas_queue_event(event, &ha->event_lock, &phy->phy_events_pending, | 53 | sas_queue_event(event, &ha->event_lock, &phy->phy_events_pending, |
54 | &phy->phy_events[event], ha->core.shost); | 54 | &phy->phy_events[event].work, ha->core.shost); |
55 | } | 55 | } |
56 | 56 | ||
57 | int sas_init_events(struct sas_ha_struct *sas_ha) | 57 | int sas_init_events(struct sas_ha_struct *sas_ha) |
58 | { | 58 | { |
59 | static void (*sas_ha_event_fns[HA_NUM_EVENTS])(void *) = { | 59 | static const work_func_t sas_ha_event_fns[HA_NUM_EVENTS] = { |
60 | [HAE_RESET] = sas_hae_reset, | 60 | [HAE_RESET] = sas_hae_reset, |
61 | }; | 61 | }; |
62 | 62 | ||
@@ -64,8 +64,10 @@ int sas_init_events(struct sas_ha_struct *sas_ha) | |||
64 | 64 | ||
65 | spin_lock_init(&sas_ha->event_lock); | 65 | spin_lock_init(&sas_ha->event_lock); |
66 | 66 | ||
67 | for (i = 0; i < HA_NUM_EVENTS; i++) | 67 | for (i = 0; i < HA_NUM_EVENTS; i++) { |
68 | INIT_WORK(&sas_ha->ha_events[i], sas_ha_event_fns[i], sas_ha); | 68 | INIT_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); |
69 | sas_ha->ha_events[i].ha = sas_ha; | ||
70 | } | ||
69 | 71 | ||
70 | sas_ha->notify_ha_event = notify_ha_event; | 72 | sas_ha->notify_ha_event = notify_ha_event; |
71 | sas_ha->notify_port_event = notify_port_event; | 73 | sas_ha->notify_port_event = notify_port_event; |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index c836a237fb79..7b4e9169f44d 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
@@ -65,9 +65,11 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | |||
65 | 65 | ||
66 | /* ---------- HA events ---------- */ | 66 | /* ---------- HA events ---------- */ |
67 | 67 | ||
68 | void sas_hae_reset(void *data) | 68 | void sas_hae_reset(struct work_struct *work) |
69 | { | 69 | { |
70 | struct sas_ha_struct *ha = data; | 70 | struct sas_ha_event *ev = |
71 | container_of(work, struct sas_ha_event, work); | ||
72 | struct sas_ha_struct *ha = ev->ha; | ||
71 | 73 | ||
72 | sas_begin_event(HAE_RESET, &ha->event_lock, | 74 | sas_begin_event(HAE_RESET, &ha->event_lock, |
73 | &ha->pending); | 75 | &ha->pending); |
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index bffcee474921..137d7e496b6d 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h | |||
@@ -60,11 +60,11 @@ void sas_shutdown_queue(struct sas_ha_struct *sas_ha); | |||
60 | 60 | ||
61 | void sas_deform_port(struct asd_sas_phy *phy); | 61 | void sas_deform_port(struct asd_sas_phy *phy); |
62 | 62 | ||
63 | void sas_porte_bytes_dmaed(void *); | 63 | void sas_porte_bytes_dmaed(struct work_struct *work); |
64 | void sas_porte_broadcast_rcvd(void *); | 64 | void sas_porte_broadcast_rcvd(struct work_struct *work); |
65 | void sas_porte_link_reset_err(void *); | 65 | void sas_porte_link_reset_err(struct work_struct *work); |
66 | void sas_porte_timer_event(void *); | 66 | void sas_porte_timer_event(struct work_struct *work); |
67 | void sas_porte_hard_reset(void *); | 67 | void sas_porte_hard_reset(struct work_struct *work); |
68 | 68 | ||
69 | int sas_notify_lldd_dev_found(struct domain_device *); | 69 | int sas_notify_lldd_dev_found(struct domain_device *); |
70 | void sas_notify_lldd_dev_gone(struct domain_device *); | 70 | void sas_notify_lldd_dev_gone(struct domain_device *); |
@@ -75,7 +75,7 @@ int sas_smp_get_phy_events(struct sas_phy *phy); | |||
75 | 75 | ||
76 | struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy); | 76 | struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy); |
77 | 77 | ||
78 | void sas_hae_reset(void *); | 78 | void sas_hae_reset(struct work_struct *work); |
79 | 79 | ||
80 | static inline void sas_queue_event(int event, spinlock_t *lock, | 80 | static inline void sas_queue_event(int event, spinlock_t *lock, |
81 | unsigned long *pending, | 81 | unsigned long *pending, |
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index 9340cdbae4a3..b459c4b635b1 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c | |||
@@ -30,9 +30,11 @@ | |||
30 | 30 | ||
31 | /* ---------- Phy events ---------- */ | 31 | /* ---------- Phy events ---------- */ |
32 | 32 | ||
33 | static void sas_phye_loss_of_signal(void *data) | 33 | static void sas_phye_loss_of_signal(struct work_struct *work) |
34 | { | 34 | { |
35 | struct asd_sas_phy *phy = data; | 35 | struct asd_sas_event *ev = |
36 | container_of(work, struct asd_sas_event, work); | ||
37 | struct asd_sas_phy *phy = ev->phy; | ||
36 | 38 | ||
37 | sas_begin_event(PHYE_LOSS_OF_SIGNAL, &phy->ha->event_lock, | 39 | sas_begin_event(PHYE_LOSS_OF_SIGNAL, &phy->ha->event_lock, |
38 | &phy->phy_events_pending); | 40 | &phy->phy_events_pending); |
@@ -40,18 +42,22 @@ static void sas_phye_loss_of_signal(void *data) | |||
40 | sas_deform_port(phy); | 42 | sas_deform_port(phy); |
41 | } | 43 | } |
42 | 44 | ||
43 | static void sas_phye_oob_done(void *data) | 45 | static void sas_phye_oob_done(struct work_struct *work) |
44 | { | 46 | { |
45 | struct asd_sas_phy *phy = data; | 47 | struct asd_sas_event *ev = |
48 | container_of(work, struct asd_sas_event, work); | ||
49 | struct asd_sas_phy *phy = ev->phy; | ||
46 | 50 | ||
47 | sas_begin_event(PHYE_OOB_DONE, &phy->ha->event_lock, | 51 | sas_begin_event(PHYE_OOB_DONE, &phy->ha->event_lock, |
48 | &phy->phy_events_pending); | 52 | &phy->phy_events_pending); |
49 | phy->error = 0; | 53 | phy->error = 0; |
50 | } | 54 | } |
51 | 55 | ||
52 | static void sas_phye_oob_error(void *data) | 56 | static void sas_phye_oob_error(struct work_struct *work) |
53 | { | 57 | { |
54 | struct asd_sas_phy *phy = data; | 58 | struct asd_sas_event *ev = |
59 | container_of(work, struct asd_sas_event, work); | ||
60 | struct asd_sas_phy *phy = ev->phy; | ||
55 | struct sas_ha_struct *sas_ha = phy->ha; | 61 | struct sas_ha_struct *sas_ha = phy->ha; |
56 | struct asd_sas_port *port = phy->port; | 62 | struct asd_sas_port *port = phy->port; |
57 | struct sas_internal *i = | 63 | struct sas_internal *i = |
@@ -80,9 +86,11 @@ static void sas_phye_oob_error(void *data) | |||
80 | } | 86 | } |
81 | } | 87 | } |
82 | 88 | ||
83 | static void sas_phye_spinup_hold(void *data) | 89 | static void sas_phye_spinup_hold(struct work_struct *work) |
84 | { | 90 | { |
85 | struct asd_sas_phy *phy = data; | 91 | struct asd_sas_event *ev = |
92 | container_of(work, struct asd_sas_event, work); | ||
93 | struct asd_sas_phy *phy = ev->phy; | ||
86 | struct sas_ha_struct *sas_ha = phy->ha; | 94 | struct sas_ha_struct *sas_ha = phy->ha; |
87 | struct sas_internal *i = | 95 | struct sas_internal *i = |
88 | to_sas_internal(sas_ha->core.shost->transportt); | 96 | to_sas_internal(sas_ha->core.shost->transportt); |
@@ -100,14 +108,14 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
100 | { | 108 | { |
101 | int i; | 109 | int i; |
102 | 110 | ||
103 | static void (*sas_phy_event_fns[PHY_NUM_EVENTS])(void *) = { | 111 | static const work_func_t sas_phy_event_fns[PHY_NUM_EVENTS] = { |
104 | [PHYE_LOSS_OF_SIGNAL] = sas_phye_loss_of_signal, | 112 | [PHYE_LOSS_OF_SIGNAL] = sas_phye_loss_of_signal, |
105 | [PHYE_OOB_DONE] = sas_phye_oob_done, | 113 | [PHYE_OOB_DONE] = sas_phye_oob_done, |
106 | [PHYE_OOB_ERROR] = sas_phye_oob_error, | 114 | [PHYE_OOB_ERROR] = sas_phye_oob_error, |
107 | [PHYE_SPINUP_HOLD] = sas_phye_spinup_hold, | 115 | [PHYE_SPINUP_HOLD] = sas_phye_spinup_hold, |
108 | }; | 116 | }; |
109 | 117 | ||
110 | static void (*sas_port_event_fns[PORT_NUM_EVENTS])(void *) = { | 118 | static const work_func_t sas_port_event_fns[PORT_NUM_EVENTS] = { |
111 | [PORTE_BYTES_DMAED] = sas_porte_bytes_dmaed, | 119 | [PORTE_BYTES_DMAED] = sas_porte_bytes_dmaed, |
112 | [PORTE_BROADCAST_RCVD] = sas_porte_broadcast_rcvd, | 120 | [PORTE_BROADCAST_RCVD] = sas_porte_broadcast_rcvd, |
113 | [PORTE_LINK_RESET_ERR] = sas_porte_link_reset_err, | 121 | [PORTE_LINK_RESET_ERR] = sas_porte_link_reset_err, |
@@ -122,13 +130,18 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
122 | 130 | ||
123 | phy->error = 0; | 131 | phy->error = 0; |
124 | INIT_LIST_HEAD(&phy->port_phy_el); | 132 | INIT_LIST_HEAD(&phy->port_phy_el); |
125 | for (k = 0; k < PORT_NUM_EVENTS; k++) | 133 | for (k = 0; k < PORT_NUM_EVENTS; k++) { |
126 | INIT_WORK(&phy->port_events[k], sas_port_event_fns[k], | 134 | INIT_WORK(&phy->port_events[k].work, |
127 | phy); | 135 | sas_port_event_fns[k]); |
136 | phy->port_events[k].phy = phy; | ||
137 | } | ||
138 | |||
139 | for (k = 0; k < PHY_NUM_EVENTS; k++) { | ||
140 | INIT_WORK(&phy->phy_events[k].work, | ||
141 | sas_phy_event_fns[k]); | ||
142 | phy->phy_events[k].phy = phy; | ||
143 | } | ||
128 | 144 | ||
129 | for (k = 0; k < PHY_NUM_EVENTS; k++) | ||
130 | INIT_WORK(&phy->phy_events[k], sas_phy_event_fns[k], | ||
131 | phy); | ||
132 | phy->port = NULL; | 145 | phy->port = NULL; |
133 | phy->ha = sas_ha; | 146 | phy->ha = sas_ha; |
134 | spin_lock_init(&phy->frame_rcvd_lock); | 147 | spin_lock_init(&phy->frame_rcvd_lock); |
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 253cdcf306a2..971c37ceecb4 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
@@ -181,9 +181,11 @@ void sas_deform_port(struct asd_sas_phy *phy) | |||
181 | 181 | ||
182 | /* ---------- SAS port events ---------- */ | 182 | /* ---------- SAS port events ---------- */ |
183 | 183 | ||
184 | void sas_porte_bytes_dmaed(void *data) | 184 | void sas_porte_bytes_dmaed(struct work_struct *work) |
185 | { | 185 | { |
186 | struct asd_sas_phy *phy = data; | 186 | struct asd_sas_event *ev = |
187 | container_of(work, struct asd_sas_event, work); | ||
188 | struct asd_sas_phy *phy = ev->phy; | ||
187 | 189 | ||
188 | sas_begin_event(PORTE_BYTES_DMAED, &phy->ha->event_lock, | 190 | sas_begin_event(PORTE_BYTES_DMAED, &phy->ha->event_lock, |
189 | &phy->port_events_pending); | 191 | &phy->port_events_pending); |
@@ -191,11 +193,13 @@ void sas_porte_bytes_dmaed(void *data) | |||
191 | sas_form_port(phy); | 193 | sas_form_port(phy); |
192 | } | 194 | } |
193 | 195 | ||
194 | void sas_porte_broadcast_rcvd(void *data) | 196 | void sas_porte_broadcast_rcvd(struct work_struct *work) |
195 | { | 197 | { |
198 | struct asd_sas_event *ev = | ||
199 | container_of(work, struct asd_sas_event, work); | ||
200 | struct asd_sas_phy *phy = ev->phy; | ||
196 | unsigned long flags; | 201 | unsigned long flags; |
197 | u32 prim; | 202 | u32 prim; |
198 | struct asd_sas_phy *phy = data; | ||
199 | 203 | ||
200 | sas_begin_event(PORTE_BROADCAST_RCVD, &phy->ha->event_lock, | 204 | sas_begin_event(PORTE_BROADCAST_RCVD, &phy->ha->event_lock, |
201 | &phy->port_events_pending); | 205 | &phy->port_events_pending); |
@@ -208,9 +212,11 @@ void sas_porte_broadcast_rcvd(void *data) | |||
208 | sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); | 212 | sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); |
209 | } | 213 | } |
210 | 214 | ||
211 | void sas_porte_link_reset_err(void *data) | 215 | void sas_porte_link_reset_err(struct work_struct *work) |
212 | { | 216 | { |
213 | struct asd_sas_phy *phy = data; | 217 | struct asd_sas_event *ev = |
218 | container_of(work, struct asd_sas_event, work); | ||
219 | struct asd_sas_phy *phy = ev->phy; | ||
214 | 220 | ||
215 | sas_begin_event(PORTE_LINK_RESET_ERR, &phy->ha->event_lock, | 221 | sas_begin_event(PORTE_LINK_RESET_ERR, &phy->ha->event_lock, |
216 | &phy->port_events_pending); | 222 | &phy->port_events_pending); |
@@ -218,9 +224,11 @@ void sas_porte_link_reset_err(void *data) | |||
218 | sas_deform_port(phy); | 224 | sas_deform_port(phy); |
219 | } | 225 | } |
220 | 226 | ||
221 | void sas_porte_timer_event(void *data) | 227 | void sas_porte_timer_event(struct work_struct *work) |
222 | { | 228 | { |
223 | struct asd_sas_phy *phy = data; | 229 | struct asd_sas_event *ev = |
230 | container_of(work, struct asd_sas_event, work); | ||
231 | struct asd_sas_phy *phy = ev->phy; | ||
224 | 232 | ||
225 | sas_begin_event(PORTE_TIMER_EVENT, &phy->ha->event_lock, | 233 | sas_begin_event(PORTE_TIMER_EVENT, &phy->ha->event_lock, |
226 | &phy->port_events_pending); | 234 | &phy->port_events_pending); |
@@ -228,9 +236,11 @@ void sas_porte_timer_event(void *data) | |||
228 | sas_deform_port(phy); | 236 | sas_deform_port(phy); |
229 | } | 237 | } |
230 | 238 | ||
231 | void sas_porte_hard_reset(void *data) | 239 | void sas_porte_hard_reset(struct work_struct *work) |
232 | { | 240 | { |
233 | struct asd_sas_phy *phy = data; | 241 | struct asd_sas_event *ev = |
242 | container_of(work, struct asd_sas_event, work); | ||
243 | struct asd_sas_phy *phy = ev->phy; | ||
234 | 244 | ||
235 | sas_begin_event(PORTE_HARD_RESET, &phy->ha->event_lock, | 245 | sas_begin_event(PORTE_HARD_RESET, &phy->ha->event_lock, |
236 | &phy->port_events_pending); | 246 | &phy->port_events_pending); |