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.

ata: libata-scsi: make ata_scsi_simulate() static

ata_scsi_simulate() is called only from libata-scsi.c. Move this
function definition as a static function before its call in
__ata_scsi_queuecmd() and remove its declaration from
include/linux/libata.h.

No functional changes.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>

+73 -75
+73 -74
drivers/ata/libata-scsi.c
··· 4420 4420 return NULL; 4421 4421 } 4422 4422 4423 + /** 4424 + * ata_scsi_simulate - simulate SCSI command on ATA device 4425 + * @dev: the target device 4426 + * @cmd: SCSI command being sent to device. 4427 + * 4428 + * Interprets and directly executes a select list of SCSI commands 4429 + * that can be handled internally. 4430 + * 4431 + * LOCKING: 4432 + * spin_lock_irqsave(host lock) 4433 + */ 4434 + static void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) 4435 + { 4436 + const u8 *scsicmd = cmd->cmnd; 4437 + u8 tmp8; 4438 + 4439 + switch (scsicmd[0]) { 4440 + case INQUIRY: 4441 + ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry); 4442 + break; 4443 + 4444 + case MODE_SENSE: 4445 + case MODE_SENSE_10: 4446 + ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense); 4447 + break; 4448 + 4449 + case READ_CAPACITY: 4450 + case SERVICE_ACTION_IN_16: 4451 + ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap); 4452 + break; 4453 + 4454 + case REPORT_LUNS: 4455 + ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns); 4456 + break; 4457 + 4458 + case REQUEST_SENSE: 4459 + ata_scsi_set_sense(dev, cmd, 0, 0, 0); 4460 + break; 4461 + 4462 + /* if we reach this, then writeback caching is disabled, 4463 + * turning this into a no-op. 4464 + */ 4465 + case SYNCHRONIZE_CACHE: 4466 + case SYNCHRONIZE_CACHE_16: 4467 + fallthrough; 4468 + 4469 + /* no-op's, complete with success */ 4470 + case REZERO_UNIT: 4471 + case SEEK_6: 4472 + case SEEK_10: 4473 + case TEST_UNIT_READY: 4474 + break; 4475 + 4476 + case SEND_DIAGNOSTIC: 4477 + tmp8 = scsicmd[1] & ~(1 << 3); 4478 + if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4]) 4479 + ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); 4480 + break; 4481 + 4482 + case MAINTENANCE_IN: 4483 + ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in); 4484 + break; 4485 + 4486 + /* all other commands */ 4487 + default: 4488 + ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0); 4489 + /* "Invalid command operation code" */ 4490 + break; 4491 + } 4492 + 4493 + scsi_done(cmd); 4494 + } 4495 + 4423 4496 enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd, 4424 4497 struct ata_device *dev) 4425 4498 { ··· 4594 4521 return rc; 4595 4522 } 4596 4523 EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 4597 - 4598 - /** 4599 - * ata_scsi_simulate - simulate SCSI command on ATA device 4600 - * @dev: the target device 4601 - * @cmd: SCSI command being sent to device. 4602 - * 4603 - * Interprets and directly executes a select list of SCSI commands 4604 - * that can be handled internally. 4605 - * 4606 - * LOCKING: 4607 - * spin_lock_irqsave(host lock) 4608 - */ 4609 - 4610 - void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) 4611 - { 4612 - const u8 *scsicmd = cmd->cmnd; 4613 - u8 tmp8; 4614 - 4615 - switch(scsicmd[0]) { 4616 - case INQUIRY: 4617 - ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry); 4618 - break; 4619 - 4620 - case MODE_SENSE: 4621 - case MODE_SENSE_10: 4622 - ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense); 4623 - break; 4624 - 4625 - case READ_CAPACITY: 4626 - case SERVICE_ACTION_IN_16: 4627 - ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap); 4628 - break; 4629 - 4630 - case REPORT_LUNS: 4631 - ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns); 4632 - break; 4633 - 4634 - case REQUEST_SENSE: 4635 - ata_scsi_set_sense(dev, cmd, 0, 0, 0); 4636 - break; 4637 - 4638 - /* if we reach this, then writeback caching is disabled, 4639 - * turning this into a no-op. 4640 - */ 4641 - case SYNCHRONIZE_CACHE: 4642 - case SYNCHRONIZE_CACHE_16: 4643 - fallthrough; 4644 - 4645 - /* no-op's, complete with success */ 4646 - case REZERO_UNIT: 4647 - case SEEK_6: 4648 - case SEEK_10: 4649 - case TEST_UNIT_READY: 4650 - break; 4651 - 4652 - case SEND_DIAGNOSTIC: 4653 - tmp8 = scsicmd[1] & ~(1 << 3); 4654 - if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4]) 4655 - ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); 4656 - break; 4657 - 4658 - case MAINTENANCE_IN: 4659 - ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in); 4660 - break; 4661 - 4662 - /* all other commands */ 4663 - default: 4664 - ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0); 4665 - /* "Invalid command operation code" */ 4666 - break; 4667 - } 4668 - 4669 - scsi_done(cmd); 4670 - } 4671 4524 4672 4525 int ata_scsi_add_hosts(struct ata_host *host, const struct scsi_host_template *sht) 4673 4526 {
-1
include/linux/libata.h
··· 1205 1205 struct ata_taskfile *tf, __le16 *id); 1206 1206 extern void ata_qc_complete(struct ata_queued_cmd *qc); 1207 1207 extern u64 ata_qc_get_active(struct ata_port *ap); 1208 - extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); 1209 1208 extern int ata_std_bios_param(struct scsi_device *sdev, 1210 1209 struct gendisk *unused, 1211 1210 sector_t capacity, int geom[]);