mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
ata: Annotate functions in the issuing path with __must_hold()
Annotate the following functions used in the issuing path: ata_qc_issue(), ata_sas_queuecmd(), ata_scsi_qc_issue(), ata_scsi_translate(), __ata_scsi_queuecmd() These functions are all used in the issuing path, so context analysis will be able to verify that the ap lock is held, from it is taken in sas_queuecommand() or ata_scsi_queuecmd() all the way down to ata_qc_issue(). Commenting out the spin_lock_irqsave() successfully results in a compiler error on Clang 23. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Co-developed-by: Niklas Cassel <cassel@kernel.org> Reviewed-by: Hannes Reinecke <hare@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org>
This commit is contained in:
committed by
Niklas Cassel
parent
b2412353ad
commit
042f5526cf
@@ -5162,6 +5162,7 @@ EXPORT_SYMBOL_GPL(ata_qc_get_active);
|
||||
* spin_lock_irqsave(host lock)
|
||||
*/
|
||||
void ata_qc_issue(struct ata_port *ap, struct ata_queued_cmd *qc)
|
||||
__must_hold(ap->lock)
|
||||
{
|
||||
struct ata_link *link = qc->dev->link;
|
||||
u8 prot = qc->tf.protocol;
|
||||
|
||||
@@ -1377,6 +1377,7 @@ EXPORT_SYMBOL_GPL(ata_sas_sdev_configure);
|
||||
*/
|
||||
|
||||
int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
|
||||
__must_hold(ap->lock)
|
||||
{
|
||||
if (likely(ata_dev_enabled(ap->link.device)))
|
||||
return __ata_scsi_queuecmd(cmd, ap->link.device, ap);
|
||||
|
||||
@@ -1769,6 +1769,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
|
||||
}
|
||||
|
||||
static int ata_scsi_qc_issue(struct ata_port *ap, struct ata_queued_cmd *qc)
|
||||
__must_hold(ap->lock)
|
||||
{
|
||||
struct ata_link *link = qc->dev->link;
|
||||
int ret;
|
||||
@@ -1864,6 +1865,7 @@ static int ata_scsi_qc_issue(struct ata_port *ap, struct ata_queued_cmd *qc)
|
||||
*/
|
||||
static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
|
||||
ata_xlat_func_t xlat_func, struct ata_port *ap)
|
||||
__must_hold(ap->lock)
|
||||
{
|
||||
struct ata_queued_cmd *qc;
|
||||
|
||||
@@ -4523,6 +4525,7 @@ static void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
|
||||
enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
|
||||
struct ata_device *dev,
|
||||
struct ata_port *ap)
|
||||
__must_hold(ap->lock)
|
||||
{
|
||||
u8 scsi_op = scmd->cmnd[0];
|
||||
ata_xlat_func_t xlat_func;
|
||||
|
||||
@@ -88,7 +88,8 @@ extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
|
||||
extern unsigned int ata_dev_set_feature(struct ata_device *dev,
|
||||
u8 subcmd, u8 action);
|
||||
extern void ata_qc_free(struct ata_queued_cmd *qc);
|
||||
extern void ata_qc_issue(struct ata_port *ap, struct ata_queued_cmd *qc);
|
||||
extern void ata_qc_issue(struct ata_port *ap, struct ata_queued_cmd *qc)
|
||||
__must_hold(ap->lock);
|
||||
extern void __ata_qc_complete(struct ata_queued_cmd *qc);
|
||||
extern int atapi_check_dma(struct ata_queued_cmd *qc);
|
||||
extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
|
||||
@@ -167,7 +168,8 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
|
||||
struct ata_device *dev);
|
||||
enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
|
||||
struct ata_device *dev,
|
||||
struct ata_port *ap);
|
||||
struct ata_port *ap)
|
||||
__must_hold(ap->lock);
|
||||
void ata_scsi_deferred_qc_work(struct work_struct *work);
|
||||
void ata_scsi_requeue_deferred_qc(struct ata_port *ap);
|
||||
|
||||
|
||||
@@ -1315,7 +1315,8 @@ extern int ata_tport_add(struct device *parent, struct ata_port *ap);
|
||||
extern void ata_tport_delete(struct ata_port *ap);
|
||||
int ata_sas_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim,
|
||||
struct ata_port *ap);
|
||||
extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
|
||||
extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
|
||||
__must_hold(ap->lock);
|
||||
extern void ata_tf_to_fis(const struct ata_taskfile *tf,
|
||||
u8 pmp, int is_cmd, u8 *fis);
|
||||
extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
|
||||
|
||||
Reference in New Issue
Block a user