Re: [PATCH -next] spi: introduce new helpers with using modern naming

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

 



Hi Yang,

On Thu, Sep 29, 2022 at 3:04 PM Yang Yingliang <yangyingliang@xxxxxxxxxx> wrote:
> For using modern names host/target to instead of all the legacy names,
> I think it takes 3 steps:
>   - step1: introduce new helpers with modern naming.
>   - step2: switch to use these new helpers in all drivers.
>   - step3: remove all legacy helpers and update all legacy names.
>
> This patch is for step1, it introduces new helpers with host/target
> naming for drivers using.
>
> Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>

Thanks for your patch!

> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -356,6 +356,7 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
>   * @max_speed_hz: Highest supported transfer speed
>   * @flags: other constraints relevant to this driver
>   * @slave: indicates that this is an SPI slave controller
> + * @target: indicates that this is an SPI target controller
>   * @devm_allocated: whether the allocation of this struct is devres-managed
>   * @max_transfer_size: function that returns the max transfer size for
>   *     a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
> @@ -438,6 +439,7 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
>   * @mem_caps: controller capabilities for the handling of memory operations.
>   * @unprepare_message: undo any work done by prepare_message().
>   * @slave_abort: abort the ongoing transfer request on an SPI slave controller
> + * @target_abort: abort the ongoing transfer request on an SPI target controller
>   * @cs_gpiods: Array of GPIO descs to use as chip select lines; one per CS
>   *     number. Any individual value may be NULL for CS lines that
>   *     are not GPIOs (driven by the SPI controller itself).
> @@ -535,6 +537,8 @@ struct spi_controller {
>
>         /* Flag indicating this is an SPI slave controller */
>         bool                    slave;
> +       /* Flag indicating this is an SPI target controller */
> +       bool                    target;

To avoid subtle breakage when accessing these fields directly,
this should be a union:

    union {
            bool slave;
            bool target;
    };

>
>         /*
>          * on some hardware transfer / message size may be constrained

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux