Re: [PATCH v2 23/29] media: vimc: Release resources on media device release

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

 



Hi Hans,

On Wed, Feb 21, 2024 at 12:19:21PM +0100, Hans Verkuil wrote:
> On 21/02/2024 11:53, Sakari Ailus wrote:
> > Hi Hans,
> > 
> > On Mon, Feb 05, 2024 at 04:02:24PM +0100, Hans Verkuil wrote:
> >> On 20/12/2023 11:37, Sakari Ailus wrote:
> >>> Release all the resources when the media device is related, moving away
> > 
> > s/related/released/
> > 
> >>> form the struct v4l2_device used for that purpose.
> >>
> >> form -> from
> > 
> > Yes.
> > 
> >>
> >>>
> >>> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> >>> ---
> >>>  drivers/media/test-drivers/vimc/vimc-core.c | 15 +++++++++------
> >>>  1 file changed, 9 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/media/test-drivers/vimc/vimc-core.c b/drivers/media/test-drivers/vimc/vimc-core.c
> >>> index af127476e920..3e59f8c256c7 100644
> >>> --- a/drivers/media/test-drivers/vimc/vimc-core.c
> >>> +++ b/drivers/media/test-drivers/vimc/vimc-core.c
> >>> @@ -264,13 +264,12 @@ static int vimc_add_subdevs(struct vimc_device *vimc)
> >>>  	return 0;
> >>>  }
> >>>  
> >>> -static void vimc_v4l2_dev_release(struct v4l2_device *v4l2_dev)
> >>> +static void vimc_mdev_release(struct media_device *mdev)
> >>>  {
> >>>  	struct vimc_device *vimc =
> >>> -		container_of(v4l2_dev, struct vimc_device, v4l2_dev);
> >>> +		container_of_const(mdev, struct vimc_device, mdev);
> >>
> >> Why this change?
> > 
> > I changed the line already. There's no reason to continue using
> > container_of() instead of container_of_const() that takes const-ness into
> > account, too.
> 
> But neither vimc nor mdev can be const anyway, that would make no sense
> here.

Neither is const, true. Yet container_of_const() is preferred over
container_of(), due to the fact that it does take const-ness into account.
container_of() should really be avoided.

I'll add this to the commit message as Laurent suggested.

-- 
Sakari Ailus




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux