Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge patch series "libsas cleanups"

Damien Le Moal <dlemoal@kernel.org> says:

Martin, John,

While debugging an issue with the pm8001 driver, I generated these
cleanup patches. No functional changes overall.

These patches are against the 6.17/scsi-staging branch of the scsi tree.

Link: https://lore.kernel.org/r/20250725015818.171252-1-dlemoal@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+101 -99
+2 -8
drivers/scsi/libsas/sas_ata.c
··· 252 252 return ata_dev_classify(&tf); 253 253 } 254 254 255 - int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) 255 + static int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) 256 256 { 257 257 if (phy->attached_tproto & SAS_PROTOCOL_STP) 258 258 dev->tproto = phy->attached_tproto; ··· 927 927 928 928 void sas_ata_wait_eh(struct domain_device *dev) 929 929 { 930 - struct ata_port *ap; 931 - 932 - if (!dev_is_sata(dev)) 933 - return; 934 - 935 - ap = dev->sata_dev.ap; 936 - ata_port_wait_eh(ap); 930 + ata_port_wait_eh(dev->sata_dev.ap); 937 931 } 938 932 939 933 void sas_ata_device_link_abort(struct domain_device *device, bool force_reset)
+1 -1
drivers/scsi/libsas/sas_discover.c
··· 406 406 } 407 407 } 408 408 409 - void sas_unregister_domain_devices(struct asd_sas_port *port, int gone) 409 + void sas_unregister_domain_devices(struct asd_sas_port *port, bool gone) 410 410 { 411 411 struct domain_device *dev, *n; 412 412
+76 -2
drivers/scsi/libsas/sas_internal.h
··· 44 44 int sas_discover_root_expander(struct domain_device *dev); 45 45 46 46 int sas_ex_revalidate_domain(struct domain_device *dev); 47 - void sas_unregister_domain_devices(struct asd_sas_port *port, int gone); 47 + void sas_unregister_domain_devices(struct asd_sas_port *port, bool gone); 48 48 void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port); 49 49 void sas_discover_event(struct asd_sas_port *port, enum discover_event ev); 50 50 ··· 70 70 void sas_queue_deferred_work(struct sas_ha_struct *ha); 71 71 void __sas_drain_work(struct sas_ha_struct *ha); 72 72 73 - void sas_deform_port(struct asd_sas_phy *phy, int gone); 73 + void sas_deform_port(struct asd_sas_phy *phy, bool gone); 74 74 75 75 void sas_porte_bytes_dmaed(struct work_struct *work); 76 76 void sas_porte_broadcast_rcvd(struct work_struct *work); ··· 221 221 { 222 222 kref_put(&dev->kref, sas_free_device); 223 223 } 224 + 225 + #ifdef CONFIG_SCSI_SAS_ATA 226 + 227 + int sas_ata_init(struct domain_device *dev); 228 + void sas_ata_task_abort(struct sas_task *task); 229 + int sas_discover_sata(struct domain_device *dev); 230 + int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, 231 + struct domain_device *child, int phy_id); 232 + void sas_ata_strategy_handler(struct Scsi_Host *shost); 233 + void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q); 234 + void sas_ata_end_eh(struct ata_port *ap); 235 + void sas_ata_wait_eh(struct domain_device *dev); 236 + void sas_probe_sata(struct asd_sas_port *port); 237 + void sas_suspend_sata(struct asd_sas_port *port); 238 + void sas_resume_sata(struct asd_sas_port *port); 239 + 240 + #else 241 + 242 + static inline int sas_ata_init(struct domain_device *dev) 243 + { 244 + return 0; 245 + } 246 + 247 + static inline void sas_ata_task_abort(struct sas_task *task) 248 + { 249 + } 250 + 251 + static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) 252 + { 253 + } 254 + 255 + static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q) 256 + { 257 + } 258 + 259 + static inline void sas_ata_end_eh(struct ata_port *ap) 260 + { 261 + } 262 + 263 + static inline void sas_ata_wait_eh(struct domain_device *dev) 264 + { 265 + } 266 + 267 + static inline void sas_probe_sata(struct asd_sas_port *port) 268 + { 269 + } 270 + 271 + static inline void sas_suspend_sata(struct asd_sas_port *port) 272 + { 273 + } 274 + 275 + static inline void sas_resume_sata(struct asd_sas_port *port) 276 + { 277 + } 278 + 279 + static inline void sas_ata_disabled_notice(void) 280 + { 281 + pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n"); 282 + } 283 + 284 + static inline int sas_discover_sata(struct domain_device *dev) 285 + { 286 + sas_ata_disabled_notice(); 287 + return -ENXIO; 288 + } 289 + 290 + static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, 291 + struct domain_device *child, int phy_id) 292 + { 293 + sas_ata_disabled_notice(); 294 + return -ENODEV; 295 + } 296 + 297 + #endif 224 298 225 299 #endif /* _SAS_INTERNAL_H_ */
+3 -3
drivers/scsi/libsas/sas_phy.c
··· 20 20 struct asd_sas_phy *phy = ev->phy; 21 21 22 22 phy->error = 0; 23 - sas_deform_port(phy, 1); 23 + sas_deform_port(phy, true); 24 24 } 25 25 26 26 static void sas_phye_oob_done(struct work_struct *work) ··· 40 40 struct sas_internal *i = 41 41 to_sas_internal(sas_ha->shost->transportt); 42 42 43 - sas_deform_port(phy, 1); 43 + sas_deform_port(phy, true); 44 44 45 45 if (!port && phy->enabled && i->dft->lldd_control_phy) { 46 46 phy->error++; ··· 85 85 86 86 phy->error = 0; 87 87 phy->suspended = 0; 88 - sas_deform_port(phy, 1); 88 + sas_deform_port(phy, true); 89 89 } 90 90 91 91
+6 -7
drivers/scsi/libsas/sas_port.c
··· 113 113 114 114 if (port) { 115 115 if (!phy_is_wideport_member(port, phy)) 116 - sas_deform_port(phy, 0); 116 + sas_deform_port(phy, false); 117 117 else if (phy->suspended) { 118 118 phy->suspended = 0; 119 119 sas_resume_port(phy); ··· 206 206 * This is called when the physical link to the other phy has been 207 207 * lost (on this phy), in Event thread context. We cannot delay here. 208 208 */ 209 - void sas_deform_port(struct asd_sas_phy *phy, int gone) 209 + void sas_deform_port(struct asd_sas_phy *phy, bool gone) 210 210 { 211 211 struct sas_ha_struct *sas_ha = phy->ha; 212 212 struct asd_sas_port *port = phy->port; ··· 301 301 struct asd_sas_event *ev = to_asd_sas_event(work); 302 302 struct asd_sas_phy *phy = ev->phy; 303 303 304 - sas_deform_port(phy, 1); 304 + sas_deform_port(phy, true); 305 305 } 306 306 307 307 void sas_porte_timer_event(struct work_struct *work) ··· 309 309 struct asd_sas_event *ev = to_asd_sas_event(work); 310 310 struct asd_sas_phy *phy = ev->phy; 311 311 312 - sas_deform_port(phy, 1); 312 + sas_deform_port(phy, true); 313 313 } 314 314 315 315 void sas_porte_hard_reset(struct work_struct *work) ··· 317 317 struct asd_sas_event *ev = to_asd_sas_event(work); 318 318 struct asd_sas_phy *phy = ev->phy; 319 319 320 - sas_deform_port(phy, 1); 320 + sas_deform_port(phy, true); 321 321 } 322 322 323 323 /* ---------- SAS port registration ---------- */ ··· 358 358 359 359 for (i = 0; i < sas_ha->num_phys; i++) 360 360 if (sas_ha->sas_phy[i]->port) 361 - sas_deform_port(sas_ha->sas_phy[i], 0); 362 - 361 + sas_deform_port(sas_ha->sas_phy[i], false); 363 362 } 364 363 365 364 const work_func_t sas_port_event_fns[PORT_NUM_EVENTS] = {
+13 -78
include/scsi/sas_ata.h
··· 15 15 16 16 #ifdef CONFIG_SCSI_SAS_ATA 17 17 18 - static inline int dev_is_sata(struct domain_device *dev) 18 + static inline bool dev_is_sata(struct domain_device *dev) 19 19 { 20 - return dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM || 21 - dev->dev_type == SAS_SATA_PM_PORT || dev->dev_type == SAS_SATA_PENDING; 20 + switch (dev->dev_type) { 21 + case SAS_SATA_DEV: 22 + case SAS_SATA_PENDING: 23 + case SAS_SATA_PM: 24 + case SAS_SATA_PM_PORT: 25 + return true; 26 + default: 27 + return false; 28 + } 22 29 } 23 30 24 - int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); 25 - int sas_ata_init(struct domain_device *dev); 26 - void sas_ata_task_abort(struct sas_task *task); 27 - void sas_ata_strategy_handler(struct Scsi_Host *shost); 28 - void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q); 29 31 void sas_ata_schedule_reset(struct domain_device *dev); 30 - void sas_ata_wait_eh(struct domain_device *dev); 31 - void sas_probe_sata(struct asd_sas_port *port); 32 - void sas_suspend_sata(struct asd_sas_port *port); 33 - void sas_resume_sata(struct asd_sas_port *port); 34 - void sas_ata_end_eh(struct ata_port *ap); 35 32 void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset); 36 - int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, 37 - int force_phy_id); 33 + int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, int force_phy_id); 38 34 int smp_ata_check_ready_type(struct ata_link *link); 39 - int sas_discover_sata(struct domain_device *dev); 40 - int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, 41 - struct domain_device *child, int phy_id); 42 35 43 36 extern const struct attribute_group sas_ata_sdev_attr_group; 44 37 45 38 #else 46 39 47 - static inline void sas_ata_disabled_notice(void) 40 + static inline bool dev_is_sata(struct domain_device *dev) 48 41 { 49 - pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n"); 50 - } 51 - 52 - static inline int dev_is_sata(struct domain_device *dev) 53 - { 54 - return 0; 55 - } 56 - static inline int sas_ata_init(struct domain_device *dev) 57 - { 58 - return 0; 59 - } 60 - static inline void sas_ata_task_abort(struct sas_task *task) 61 - { 62 - } 63 - 64 - static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) 65 - { 66 - } 67 - 68 - static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q) 69 - { 42 + return false; 70 43 } 71 44 72 45 static inline void sas_ata_schedule_reset(struct domain_device *dev) 73 - { 74 - } 75 - 76 - static inline void sas_ata_wait_eh(struct domain_device *dev) 77 - { 78 - } 79 - 80 - static inline void sas_probe_sata(struct asd_sas_port *port) 81 - { 82 - } 83 - 84 - static inline void sas_suspend_sata(struct asd_sas_port *port) 85 - { 86 - } 87 - 88 - static inline void sas_resume_sata(struct asd_sas_port *port) 89 - { 90 - } 91 - 92 - static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) 93 - { 94 - return 0; 95 - } 96 - 97 - static inline void sas_ata_end_eh(struct ata_port *ap) 98 46 { 99 47 } 100 48 ··· 60 112 static inline int smp_ata_check_ready_type(struct ata_link *link) 61 113 { 62 114 return 0; 63 - } 64 - 65 - static inline int sas_discover_sata(struct domain_device *dev) 66 - { 67 - sas_ata_disabled_notice(); 68 - return -ENXIO; 69 - } 70 - 71 - static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, 72 - struct domain_device *child, int phy_id) 73 - { 74 - sas_ata_disabled_notice(); 75 - return -ENODEV; 76 115 } 77 116 78 117 #define sas_ata_sdev_attr_group ((struct attribute_group) {})