hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/scsi/libsas/sas_discover.c
....@@ -1,25 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Serial Attached SCSI (SAS) Discover process
34 *
45 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
56 * 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
- *
237 */
248
259 #include <linux/scatterlist.h>
....@@ -124,7 +108,7 @@
124108 rphy = NULL;
125109 break;
126110 }
127
- /* fall through */
111
+ fallthrough;
128112 case SAS_END_DEVICE:
129113 rphy = sas_end_device_alloc(port->port);
130114 break;
....@@ -137,7 +121,7 @@
137121 SAS_FANOUT_EXPANDER_DEVICE);
138122 break;
139123 default:
140
- printk("ERROR: Unidentified device type %d\n", dev->dev_type);
124
+ pr_warn("ERROR: Unidentified device type %d\n", dev->dev_type);
141125 rphy = NULL;
142126 break;
143127 }
....@@ -195,14 +179,14 @@
195179
196180 res = i->dft->lldd_dev_found(dev);
197181 if (res) {
198
- printk("sas: driver on pcidev %s cannot handle "
199
- "device %llx, error:%d\n",
200
- dev_name(sas_ha->dev),
201
- SAS_ADDR(dev->sas_addr), res);
182
+ pr_warn("driver on host %s cannot handle device %016llx, error:%d\n",
183
+ dev_name(sas_ha->dev),
184
+ SAS_ADDR(dev->sas_addr), res);
185
+ return res;
202186 }
203187 set_bit(SAS_DEV_FOUND, &dev->state);
204188 kref_get(&dev->kref);
205
- return res;
189
+ return 0;
206190 }
207191
208192
....@@ -269,7 +253,7 @@
269253 * phy_list is not being mutated
270254 */
271255 list_for_each_entry(phy, &port->phy_list, port_phy_el) {
272
- if (si->dft->lldd_port_formed)
256
+ if (si->dft->lldd_port_deformed)
273257 si->dft->lldd_port_deformed(phy);
274258 phy->suspended = 1;
275259 port->suspended = 1;
....@@ -294,13 +278,7 @@
294278 */
295279 int sas_discover_end_dev(struct domain_device *dev)
296280 {
297
- int res;
298
-
299
- res = sas_notify_lldd_dev_found(dev);
300
- if (res)
301
- return res;
302
-
303
- return 0;
281
+ return sas_notify_lldd_dev_found(dev);
304282 }
305283
306284 /* ---------- Device registration and unregistration ---------- */
....@@ -319,7 +297,7 @@
319297 dev->phy = NULL;
320298
321299 /* remove the phys and ports, everything else should be gone */
322
- if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
300
+ if (dev_is_expander(dev->dev_type))
323301 kfree(dev->ex_dev.ex_phy);
324302
325303 if (dev_is_sata(dev) && dev->sata_dev.ap) {
....@@ -465,8 +443,8 @@
465443 return;
466444 dev = port->port_dev;
467445
468
- SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id,
469
- task_pid_nr(current));
446
+ pr_debug("DOING DISCOVERY on port %d, pid:%d\n", port->id,
447
+ task_pid_nr(current));
470448
471449 switch (dev->dev_type) {
472450 case SAS_END_DEVICE:
....@@ -482,12 +460,13 @@
482460 error = sas_discover_sata(dev);
483461 break;
484462 #else
485
- SAS_DPRINTK("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
463
+ pr_notice("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
486464 /* Fall through */
487465 #endif
466
+ /* Fall through - only for the #else condition above. */
488467 default:
489468 error = -ENXIO;
490
- SAS_DPRINTK("unhandled device %d\n", dev->dev_type);
469
+ pr_err("unhandled device %d\n", dev->dev_type);
491470 break;
492471 }
493472
....@@ -504,8 +483,8 @@
504483
505484 sas_probe_devices(port);
506485
507
- SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
508
- task_pid_nr(current), error);
486
+ pr_debug("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
487
+ task_pid_nr(current), error);
509488 }
510489
511490 static void sas_revalidate_domain(struct work_struct *work)
....@@ -519,22 +498,21 @@
519498 /* prevent revalidation from finding sata links in recovery */
520499 mutex_lock(&ha->disco_mutex);
521500 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) {
522
- SAS_DPRINTK("REVALIDATION DEFERRED on port %d, pid:%d\n",
523
- port->id, task_pid_nr(current));
501
+ pr_debug("REVALIDATION DEFERRED on port %d, pid:%d\n",
502
+ port->id, task_pid_nr(current));
524503 goto out;
525504 }
526505
527506 clear_bit(DISCE_REVALIDATE_DOMAIN, &port->disc.pending);
528507
529
- SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
530
- task_pid_nr(current));
508
+ pr_debug("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
509
+ task_pid_nr(current));
531510
532
- if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE ||
533
- ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE))
511
+ if (ddev && dev_is_expander(ddev->dev_type))
534512 res = sas_ex_revalidate_domain(ddev);
535513
536
- SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
537
- port->id, task_pid_nr(current), res);
514
+ pr_debug("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
515
+ port->id, task_pid_nr(current), res);
538516 out:
539517 mutex_unlock(&ha->disco_mutex);
540518