.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Serial Attached SCSI (SAS) Event processing |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. |
---|
5 | 6 | * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> |
---|
6 | | - * |
---|
7 | | - * This file is licensed under GPLv2. |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or |
---|
10 | | - * modify it under the terms of the GNU General Public License as |
---|
11 | | - * published by the Free Software Foundation; either version 2 of the |
---|
12 | | - * License, or (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, but |
---|
15 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | | - * General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | | - * |
---|
23 | 7 | */ |
---|
24 | 8 | |
---|
25 | 9 | #include <linux/export.h> |
---|
26 | 10 | #include <scsi/scsi_host.h> |
---|
27 | 11 | #include "sas_internal.h" |
---|
28 | | -#include "sas_dump.h" |
---|
29 | 12 | |
---|
30 | 13 | int sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) |
---|
31 | 14 | { |
---|
.. | .. |
---|
126 | 109 | |
---|
127 | 110 | sas_phy = container_of(port->phy_list.next, struct asd_sas_phy, |
---|
128 | 111 | port_phy_el); |
---|
129 | | - ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); |
---|
| 112 | + sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); |
---|
130 | 113 | } |
---|
131 | 114 | mutex_unlock(&ha->disco_mutex); |
---|
132 | 115 | } |
---|
.. | .. |
---|
148 | 131 | sas_free_event(ev); |
---|
149 | 132 | } |
---|
150 | 133 | |
---|
151 | | -static int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event) |
---|
| 134 | +static int __sas_notify_port_event(struct asd_sas_phy *phy, |
---|
| 135 | + enum port_event event, |
---|
| 136 | + struct asd_sas_event *ev) |
---|
152 | 137 | { |
---|
153 | | - struct asd_sas_event *ev; |
---|
154 | 138 | struct sas_ha_struct *ha = phy->ha; |
---|
155 | 139 | int ret; |
---|
156 | 140 | |
---|
157 | 141 | BUG_ON(event >= PORT_NUM_EVENTS); |
---|
158 | | - |
---|
159 | | - ev = sas_alloc_event(phy); |
---|
160 | | - if (!ev) |
---|
161 | | - return -ENOMEM; |
---|
162 | 142 | |
---|
163 | 143 | INIT_SAS_EVENT(ev, sas_port_event_worker, phy, event); |
---|
164 | 144 | |
---|
.. | .. |
---|
169 | 149 | return ret; |
---|
170 | 150 | } |
---|
171 | 151 | |
---|
172 | | -int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) |
---|
| 152 | +int sas_notify_port_event_gfp(struct asd_sas_phy *phy, enum port_event event, |
---|
| 153 | + gfp_t gfp_flags) |
---|
173 | 154 | { |
---|
174 | 155 | struct asd_sas_event *ev; |
---|
175 | | - struct sas_ha_struct *ha = phy->ha; |
---|
176 | | - int ret; |
---|
177 | 156 | |
---|
178 | | - BUG_ON(event >= PHY_NUM_EVENTS); |
---|
| 157 | + ev = sas_alloc_event_gfp(phy, gfp_flags); |
---|
| 158 | + if (!ev) |
---|
| 159 | + return -ENOMEM; |
---|
| 160 | + |
---|
| 161 | + return __sas_notify_port_event(phy, event, ev); |
---|
| 162 | +} |
---|
| 163 | +EXPORT_SYMBOL_GPL(sas_notify_port_event_gfp); |
---|
| 164 | + |
---|
| 165 | +int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event) |
---|
| 166 | +{ |
---|
| 167 | + struct asd_sas_event *ev; |
---|
179 | 168 | |
---|
180 | 169 | ev = sas_alloc_event(phy); |
---|
181 | 170 | if (!ev) |
---|
182 | 171 | return -ENOMEM; |
---|
| 172 | + |
---|
| 173 | + return __sas_notify_port_event(phy, event, ev); |
---|
| 174 | +} |
---|
| 175 | +EXPORT_SYMBOL_GPL(sas_notify_port_event); |
---|
| 176 | + |
---|
| 177 | +static inline int __sas_notify_phy_event(struct asd_sas_phy *phy, |
---|
| 178 | + enum phy_event event, |
---|
| 179 | + struct asd_sas_event *ev) |
---|
| 180 | +{ |
---|
| 181 | + struct sas_ha_struct *ha = phy->ha; |
---|
| 182 | + int ret; |
---|
| 183 | + |
---|
| 184 | + BUG_ON(event >= PHY_NUM_EVENTS); |
---|
183 | 185 | |
---|
184 | 186 | INIT_SAS_EVENT(ev, sas_phy_event_worker, phy, event); |
---|
185 | 187 | |
---|
.. | .. |
---|
190 | 192 | return ret; |
---|
191 | 193 | } |
---|
192 | 194 | |
---|
193 | | -int sas_init_events(struct sas_ha_struct *sas_ha) |
---|
| 195 | +int sas_notify_phy_event_gfp(struct asd_sas_phy *phy, enum phy_event event, |
---|
| 196 | + gfp_t gfp_flags) |
---|
194 | 197 | { |
---|
195 | | - sas_ha->notify_port_event = sas_notify_port_event; |
---|
196 | | - sas_ha->notify_phy_event = sas_notify_phy_event; |
---|
| 198 | + struct asd_sas_event *ev; |
---|
197 | 199 | |
---|
198 | | - return 0; |
---|
| 200 | + ev = sas_alloc_event_gfp(phy, gfp_flags); |
---|
| 201 | + if (!ev) |
---|
| 202 | + return -ENOMEM; |
---|
| 203 | + |
---|
| 204 | + return __sas_notify_phy_event(phy, event, ev); |
---|
199 | 205 | } |
---|
| 206 | +EXPORT_SYMBOL_GPL(sas_notify_phy_event_gfp); |
---|
| 207 | + |
---|
| 208 | +int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event) |
---|
| 209 | +{ |
---|
| 210 | + struct asd_sas_event *ev; |
---|
| 211 | + |
---|
| 212 | + ev = sas_alloc_event(phy); |
---|
| 213 | + if (!ev) |
---|
| 214 | + return -ENOMEM; |
---|
| 215 | + |
---|
| 216 | + return __sas_notify_phy_event(phy, event, ev); |
---|
| 217 | +} |
---|
| 218 | +EXPORT_SYMBOL_GPL(sas_notify_phy_event); |
---|