> +/** > + * zl3073x_mb_dpll_read - read given DPLL configuration to mailbox > + * @zldev: pointer to device structure > + * @index: DPLL index > + * > + * Reads configuration of given DPLL into DPLL mailbox. > + * > + * Context: Process context. Expects zldev->regmap_lock to be held by caller. > + * Return: 0 on success, <0 on error > + */ > +int zl3073x_mb_dpll_read(struct zl3073x_dev *zldev, u8 index) > +{ > + int rc;
lockdep_assert_held(zldev->regmap_lock) is stronger than having a comment. When talking about i2c and spi devices, it costs nothing, and catches bugs early. > +/* > + * Mailbox operations > + */ > +int zl3073x_mb_dpll_read(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_dpll_write(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_output_read(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_output_write(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_ref_read(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_ref_write(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_synth_read(struct zl3073x_dev *zldev, u8 index); > +int zl3073x_mb_synth_write(struct zl3073x_dev *zldev, u8 index); I assume these are the only valid ways to access a mailbox? If so: > +static inline __maybe_unused int > +zl3073x_mb_read_ref_mb_mask(struct zl3073x_dev *zldev, u16 *value) > +{ > + __be16 temp; > + int rc; > + > + lockdep_assert_held(&zldev->mailbox_lock); > + rc = regmap_bulk_read(zldev->regmap, ZL_REG_REF_MB_MASK, &temp, > + sizeof(temp)); > + if (rc) > + return rc; > + > + *value = be16_to_cpu(temp); > + return rc; > +} These helpers can be made local to the core. You can then drop the lockdep_assert_held() from here, since the only way to access them is via the API you defined above, and add the checks in those API functions. Andrew