Re: [PATCH v2 01/18] ata: libata: allow ata_scsi_set_sense() to not set CHECK_CONDITION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 17, 2023 at 04:10:15PM +0900, Damien Le Moal wrote:
> >> +			bool check_condition, u8 sk, u8 asc, u8 ascq)
> >>  {
> >>  	bool d_sense = (dev->flags & ATA_DFLAG_D_SENSE);
> >>  
> >>  	if (!cmd)
> >>  		return;
> >>  
> >> -	scsi_build_sense(cmd, d_sense, sk, asc, ascq);
> >> +	scsi_build_sense_buffer(d_sense, cmd->sense_buffer, sk, asc, ascq);
> >> +	if (check_condition)
> >> +		set_status_byte(cmd, SAM_STAT_CHECK_CONDITION);
> >>  }
> > 
> > Adding a bool parameter do do something conditional at the end
> > of a function is always a bad idea.  Just split out a
> > __ata_scsi_set_sense helper that doesn't set the flag.
> 
> What about passing the SAM_STAT_XXX status to set as an argument ?
> Most current call site will be modified to pass SAM_STAT_CHECK_CONDITION,
> and we could add a wrapper ata_scsi_set_check_condition_sense() to
> simplify this most common case.

What's the point of that?



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux