Re: [PATCH 1/4] ata: add ata_port_is_frozen() helper

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

 



On 07/10/2022 14:23, Niklas Cassel wrote:
At the request of the libata maintainer, introduce a ata_port_is_frozen()
helper function.

Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
---
  include/linux/libata.h | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index a505cfb92ab3..d5ac52654b42 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1043,6 +1043,11 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
  	return ap->ops == &ata_dummy_port_ops;
  }

Hi Niklas,

>
> +static inline bool ata_port_is_frozen(const struct ata_port *ap)

The majority of libata APIs don't use const in this way, so I think that consistency is better.

Indeed, this is not const data which you're pointing at, so maybe it's better to be honest with the compiler. And since this is inlined, could the compiler optimise out multiple reads on ap->flags in a caller function since we tell it it's const?

Thanks,
John

+{
+	return ap->pflags & ATA_PFLAG_FROZEN;
+}
+
  extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
  extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
  				int (*check_ready)(struct ata_link *link));




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux