Re: [PATCH 03/57] media: atomisp: Remove atomisp_sw_contex struct

Andy Shevchenko
2023-01-23T14:14:23Z

On Mon, Jan 23, 2023 at 01:51:11PM +0100, Hans de Goede wrote:
> Remove the atomisp_sw_contex struct, it has only 1 member: running_freq,
> instead store running_freq directly.
>
> While at it also change running_freq from an int to an unsigned int,
> all values stored in it are unsigned and it is compared to the also
> unsigned new_freq variable.

Reviewed-by: Andy Shevchenko <andy@kernel.org>

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++--
> drivers/staging/media/atomisp/pci/atomisp_fops.c | 2 +-
> drivers/staging/media/atomisp/pci/atomisp_internal.h | 6 +-----
> 3 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index d8c7e7367386..5cea1df48b7d 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -280,14 +280,14 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
> done:
> dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq);
>
> - if ((new_freq == isp->sw_contex.running_freq) && !force)
> + if ((new_freq == isp->running_freq) && !force)
> return 0;
>
> dev_dbg(isp->dev, "Programming DFS frequency to %d\n", new_freq);
>
> ret = write_target_freq_to_hw(isp, new_freq);
> if (!ret) {
> - isp->sw_contex.running_freq = new_freq;
> + isp->running_freq = new_freq;
> trace_ipu_pstate(new_freq, -1);
> }
> return ret;
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
> index acea7492847d..4643bb0db995 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
> @@ -681,7 +681,7 @@ static void atomisp_dev_init_struct(struct atomisp_device *isp)
> * For Merrifield, frequency is scalable.
> * After boot-up, the default frequency is 200MHz.
> */
> - isp->sw_contex.running_freq = ISP_FREQ_200MHZ;
> + isp->running_freq = ISP_FREQ_200MHZ;
> }
>
> static void atomisp_subdev_init_struct(struct atomisp_sub_device *asd)
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h
> index 653e6d74a966..675007d7d9af 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h
> +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h
> @@ -194,10 +194,6 @@ struct atomisp_regs {
> u32 csi_access_viol;
> };
>
> -struct atomisp_sw_contex {
> - int running_freq;
> -};
> -
> #define ATOMISP_DEVICE_STREAMING_DISABLED 0
> #define ATOMISP_DEVICE_STREAMING_ENABLED 1
> #define ATOMISP_DEVICE_STREAMING_STOPPING 2
> @@ -242,7 +238,6 @@ struct atomisp_device {
> struct v4l2_subdev *motor;
>
> struct atomisp_regs saved_regs;
> - struct atomisp_sw_contex sw_contex;
> struct atomisp_css_env css_env;
>
> /* isp timeout status flag */
> @@ -257,6 +252,7 @@ struct atomisp_device {
> unsigned int mipi_frame_size;
> const struct atomisp_dfs_config *dfs;
> unsigned int hpll_freq;
> + unsigned int running_freq;
>
> bool css_initialized;
> };
> --
> 2.39.0
>

--
With Best Regards,
Andy Shevchenko