| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Serial Attached SCSI (SAS) Discover process |
|---|
| 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/scatterlist.h> |
|---|
| .. | .. |
|---|
| 124 | 108 | rphy = NULL; |
|---|
| 125 | 109 | break; |
|---|
| 126 | 110 | } |
|---|
| 127 | | - /* fall through */ |
|---|
| 111 | + fallthrough; |
|---|
| 128 | 112 | case SAS_END_DEVICE: |
|---|
| 129 | 113 | rphy = sas_end_device_alloc(port->port); |
|---|
| 130 | 114 | break; |
|---|
| .. | .. |
|---|
| 137 | 121 | SAS_FANOUT_EXPANDER_DEVICE); |
|---|
| 138 | 122 | break; |
|---|
| 139 | 123 | default: |
|---|
| 140 | | - printk("ERROR: Unidentified device type %d\n", dev->dev_type); |
|---|
| 124 | + pr_warn("ERROR: Unidentified device type %d\n", dev->dev_type); |
|---|
| 141 | 125 | rphy = NULL; |
|---|
| 142 | 126 | break; |
|---|
| 143 | 127 | } |
|---|
| .. | .. |
|---|
| 195 | 179 | |
|---|
| 196 | 180 | res = i->dft->lldd_dev_found(dev); |
|---|
| 197 | 181 | 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; |
|---|
| 202 | 186 | } |
|---|
| 203 | 187 | set_bit(SAS_DEV_FOUND, &dev->state); |
|---|
| 204 | 188 | kref_get(&dev->kref); |
|---|
| 205 | | - return res; |
|---|
| 189 | + return 0; |
|---|
| 206 | 190 | } |
|---|
| 207 | 191 | |
|---|
| 208 | 192 | |
|---|
| .. | .. |
|---|
| 269 | 253 | * phy_list is not being mutated |
|---|
| 270 | 254 | */ |
|---|
| 271 | 255 | 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) |
|---|
| 273 | 257 | si->dft->lldd_port_deformed(phy); |
|---|
| 274 | 258 | phy->suspended = 1; |
|---|
| 275 | 259 | port->suspended = 1; |
|---|
| .. | .. |
|---|
| 294 | 278 | */ |
|---|
| 295 | 279 | int sas_discover_end_dev(struct domain_device *dev) |
|---|
| 296 | 280 | { |
|---|
| 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); |
|---|
| 304 | 282 | } |
|---|
| 305 | 283 | |
|---|
| 306 | 284 | /* ---------- Device registration and unregistration ---------- */ |
|---|
| .. | .. |
|---|
| 319 | 297 | dev->phy = NULL; |
|---|
| 320 | 298 | |
|---|
| 321 | 299 | /* 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)) |
|---|
| 323 | 301 | kfree(dev->ex_dev.ex_phy); |
|---|
| 324 | 302 | |
|---|
| 325 | 303 | if (dev_is_sata(dev) && dev->sata_dev.ap) { |
|---|
| .. | .. |
|---|
| 465 | 443 | return; |
|---|
| 466 | 444 | dev = port->port_dev; |
|---|
| 467 | 445 | |
|---|
| 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)); |
|---|
| 470 | 448 | |
|---|
| 471 | 449 | switch (dev->dev_type) { |
|---|
| 472 | 450 | case SAS_END_DEVICE: |
|---|
| .. | .. |
|---|
| 482 | 460 | error = sas_discover_sata(dev); |
|---|
| 483 | 461 | break; |
|---|
| 484 | 462 | #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"); |
|---|
| 486 | 464 | /* Fall through */ |
|---|
| 487 | 465 | #endif |
|---|
| 466 | + /* Fall through - only for the #else condition above. */ |
|---|
| 488 | 467 | default: |
|---|
| 489 | 468 | error = -ENXIO; |
|---|
| 490 | | - SAS_DPRINTK("unhandled device %d\n", dev->dev_type); |
|---|
| 469 | + pr_err("unhandled device %d\n", dev->dev_type); |
|---|
| 491 | 470 | break; |
|---|
| 492 | 471 | } |
|---|
| 493 | 472 | |
|---|
| .. | .. |
|---|
| 504 | 483 | |
|---|
| 505 | 484 | sas_probe_devices(port); |
|---|
| 506 | 485 | |
|---|
| 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); |
|---|
| 509 | 488 | } |
|---|
| 510 | 489 | |
|---|
| 511 | 490 | static void sas_revalidate_domain(struct work_struct *work) |
|---|
| .. | .. |
|---|
| 519 | 498 | /* prevent revalidation from finding sata links in recovery */ |
|---|
| 520 | 499 | mutex_lock(&ha->disco_mutex); |
|---|
| 521 | 500 | 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)); |
|---|
| 524 | 503 | goto out; |
|---|
| 525 | 504 | } |
|---|
| 526 | 505 | |
|---|
| 527 | 506 | clear_bit(DISCE_REVALIDATE_DOMAIN, &port->disc.pending); |
|---|
| 528 | 507 | |
|---|
| 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)); |
|---|
| 531 | 510 | |
|---|
| 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)) |
|---|
| 534 | 512 | res = sas_ex_revalidate_domain(ddev); |
|---|
| 535 | 513 | |
|---|
| 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); |
|---|
| 538 | 516 | out: |
|---|
| 539 | 517 | mutex_unlock(&ha->disco_mutex); |
|---|
| 540 | 518 | |
|---|