Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1642055ybl; Sat, 10 Aug 2019 07:17:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhbjlN182CWZm+eVgypCBWmdxPiIwDpAUJyHFzl8k6NY7ufUvXO/hKR7kkNK0ywywT1C4x X-Received: by 2002:a63:e14d:: with SMTP id h13mr22284657pgk.431.1565446661902; Sat, 10 Aug 2019 07:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565446661; cv=none; d=google.com; s=arc-20160816; b=jcS+Jy/X3UB2Hig/xsi2yNIjeG1WJ0Smut0ysDCpo7XlNBh/1GDQJR8pPLfoGGjpVs NYC79VUd0HfW8Jhg6neP5Afx5qCg5Mo8nlVPgN1oP6zMjFWHUJIl5uNVp+UQTIrOe3AQ oroZBN1eTDmSsJOuvBXeeJAZ1M/h4qw2CP2G8ljzE2cL41uAPaGA/UHzUx63yvOIwWWm WMkCvXcf2irYUE+BAmlMW3kGG1PFMkfZP55Bome3Do3605CFCiGTl4QHrQsolvAtDuY1 QP4daOjFaRgwn83/5z3oWq89IfLTefZNyCDgOl1VaAHKlWuQPTgyi08lcmtPTzNj3LTp niqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Tp0RnTBFyvDQN6Y+LZiQzR0kkiVf6K7vWQRZR3ORGGs=; b=0Q4tyyJVkiJ0mQboZ8QY+Q0LJZWxUPlPYjS+oOmSRvmfpoJftOYe7XlvlbLyWAjrtV RBzwka7NkZrylSd+t/iMVIk/ptl96pFyxmrkVlKZtbOaCirsoWFz67A+EHL7E7TUEjoh eK3pcfRNmoB8C+KwafvMpq0JDEXJ/BZOiGtJ82+CCtOb/XwhEt0nBrNSqKv39obAqR1a MvPUSdsJhvTHAARGoo07xsoEsQHiSS73uSMDAQ6himrq1Z+mJ1j/RuAm4uTWtlptMWOS LDBeXSl9IaHpcB9Mc1G54nh97EFBXHRELeJLW5oYG4+WD9hLPZAFAwbB1zVWXjGIwbhW 5mlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=rX88nVNe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l97si6904534pje.6.2019.08.10.07.17.13; Sat, 10 Aug 2019 07:17:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=rX88nVNe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726204AbfHJOOi (ORCPT + 99 others); Sat, 10 Aug 2019 10:14:38 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:57214 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfHJOOh (ORCPT ); Sat, 10 Aug 2019 10:14:37 -0400 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5536F67; Sat, 10 Aug 2019 16:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1565446474; bh=bSif1YUXdro/ri2Eo/hCoZ/bPT1nH7AYvUtuX1zxJVc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rX88nVNe4tp7g4UFh28oVuvXOLwkmI1337WGUPcWEtL+R63qc4UNuW5A++iGb6gmS Ael0LZAiF5xWpeFDvCZSlxeH6LSEzaY8ca0w84XRvlBOZT9s9iZc7a9U5dfCvTxLOa +hDo/eqpUoFJ90Q02Tw/ESir0JUih1GyRRJBaii4= Date: Sat, 10 Aug 2019 17:14:32 +0300 From: Laurent Pinchart To: Shuah Khan Cc: mchehab@kernel.org, helen.koike@collabora.com, hverkuil@xs4all.nl, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 1/3] media: vimc: move private defines to a common header Message-ID: <20190810141432.GA30451@pendragon.ideasonboard.com> References: <142cc5a6a10f75ed97de8b2d9b1e73b034a88b2f.1565386363.git.skhan@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <142cc5a6a10f75ed97de8b2d9b1e73b034a88b2f.1565386363.git.skhan@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shuah, Thank you for the patch. On Fri, Aug 09, 2019 at 03:45:41PM -0600, Shuah Khan wrote: > In preparation for collapsing the component driver structure into > a monolith, move private device structure defines to a new common > header file. Apart from the vimc_device structure, this doesn't seem to be needed. I'd rather keep each structure private to the .c file that handles it, and only share vimc_device globally. > Signed-off-by: Shuah Khan > --- > drivers/media/platform/vimc/vimc-capture.c | 21 +---- > drivers/media/platform/vimc/vimc-core.c | 18 +--- > drivers/media/platform/vimc/vimc-debayer.c | 16 +--- > drivers/media/platform/vimc/vimc-scaler.c | 15 +-- > drivers/media/platform/vimc/vimc-sensor.c | 13 +-- > drivers/media/platform/vimc/vimc.h | 102 +++++++++++++++++++++ > 6 files changed, 107 insertions(+), 78 deletions(-) > create mode 100644 drivers/media/platform/vimc/vimc.h > > diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c > index 664855708fdf..c52fc5d97c2d 100644 > --- a/drivers/media/platform/vimc/vimc-capture.c > +++ b/drivers/media/platform/vimc/vimc-capture.c > @@ -13,6 +13,7 @@ > #include > #include > > +#include "vimc.h" > #include "vimc-common.h" > #include "vimc-streamer.h" > > @@ -44,26 +45,6 @@ static const u32 vimc_cap_supported_pixfmt[] = { > V4L2_PIX_FMT_SRGGB12, > }; > > -struct vimc_cap_device { > - struct vimc_ent_device ved; > - struct video_device vdev; > - struct device *dev; > - struct v4l2_pix_format format; > - struct vb2_queue queue; > - struct list_head buf_list; > - /* > - * NOTE: in a real driver, a spin lock must be used to access the > - * queue because the frames are generated from a hardware interruption > - * and the isr is not allowed to sleep. > - * Even if it is not necessary a spinlock in the vimc driver, we > - * use it here as a code reference > - */ > - spinlock_t qlock; > - struct mutex lock; > - u32 sequence; > - struct vimc_stream stream; > -}; > - > static const struct v4l2_pix_format fmt_default = { > .width = 640, > .height = 480, > diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c > index 571c55aa0e16..c9b351472272 100644 > --- a/drivers/media/platform/vimc/vimc-core.c > +++ b/drivers/media/platform/vimc/vimc-core.c > @@ -12,6 +12,7 @@ > #include > #include > > +#include "vimc.h" > #include "vimc-common.h" > > #define VIMC_MDEV_MODEL_NAME "VIMC MDEV" > @@ -24,23 +25,6 @@ > .flags = link_flags, \ > } > > -struct vimc_device { > - /* The platform device */ > - struct platform_device pdev; > - > - /* The pipeline configuration */ > - const struct vimc_pipeline_config *pipe_cfg; > - > - /* The Associated media_device parent */ > - struct media_device mdev; > - > - /* Internal v4l2 parent device*/ > - struct v4l2_device v4l2_dev; > - > - /* Subdevices */ > - struct platform_device **subdevs; > -}; > - > /* Structure which describes individual configuration for each entity */ > struct vimc_ent_config { > const char *name; > diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c > index 00598fbf3cba..750752bb173c 100644 > --- a/drivers/media/platform/vimc/vimc-debayer.c > +++ b/drivers/media/platform/vimc/vimc-debayer.c > @@ -13,6 +13,7 @@ > #include > #include > > +#include "vimc.h" > #include "vimc-common.h" > > #define VIMC_DEB_DRV_NAME "vimc-debayer" > @@ -44,21 +45,6 @@ struct vimc_deb_pix_map { > enum vimc_deb_rgb_colors order[2][2]; > }; > > -struct vimc_deb_device { > - struct vimc_ent_device ved; > - struct v4l2_subdev sd; > - struct device *dev; > - /* The active format */ > - struct v4l2_mbus_framefmt sink_fmt; > - u32 src_code; > - void (*set_rgb_src)(struct vimc_deb_device *vdeb, unsigned int lin, > - unsigned int col, unsigned int rgb[3]); > - /* Values calculated when the stream starts */ > - u8 *src_frame; > - const struct vimc_deb_pix_map *sink_pix_map; > - unsigned int sink_bpp; > -}; > - > static const struct v4l2_mbus_framefmt sink_fmt_default = { > .width = 640, > .height = 480, > diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c > index c7123a45c55b..fe99b9102ada 100644 > --- a/drivers/media/platform/vimc/vimc-scaler.c > +++ b/drivers/media/platform/vimc/vimc-scaler.c > @@ -13,6 +13,7 @@ > #include > #include > > +#include "vimc.h" > #include "vimc-common.h" > > #define VIMC_SCA_DRV_NAME "vimc-scaler" > @@ -31,20 +32,6 @@ static const u32 vimc_sca_supported_pixfmt[] = { > V4L2_PIX_FMT_ARGB32, > }; > > -struct vimc_sca_device { > - struct vimc_ent_device ved; > - struct v4l2_subdev sd; > - struct device *dev; > - /* NOTE: the source fmt is the same as the sink > - * with the width and hight multiplied by mult > - */ > - struct v4l2_mbus_framefmt sink_fmt; > - /* Values calculated when the stream starts */ > - u8 *src_frame; > - unsigned int src_line_size; > - unsigned int bpp; > -}; > - > static const struct v4l2_mbus_framefmt sink_fmt_default = { > .width = 640, > .height = 480, > diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c > index 51359472eef2..6c57b1e262f9 100644 > --- a/drivers/media/platform/vimc/vimc-sensor.c > +++ b/drivers/media/platform/vimc/vimc-sensor.c > @@ -16,22 +16,11 @@ > #include > #include > > +#include "vimc.h" > #include "vimc-common.h" > > #define VIMC_SEN_DRV_NAME "vimc-sensor" > > -struct vimc_sen_device { > - struct vimc_ent_device ved; > - struct v4l2_subdev sd; > - struct device *dev; > - struct tpg_data tpg; > - struct task_struct *kthread_sen; > - u8 *frame; > - /* The active format */ > - struct v4l2_mbus_framefmt mbus_format; > - struct v4l2_ctrl_handler hdl; > -}; > - > static const struct v4l2_mbus_framefmt fmt_default = { > .width = 640, > .height = 480, > diff --git a/drivers/media/platform/vimc/vimc.h b/drivers/media/platform/vimc/vimc.h > new file mode 100644 > index 000000000000..a5adebdda941 > --- /dev/null > +++ b/drivers/media/platform/vimc/vimc.h > @@ -0,0 +1,102 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * > + * Copyright (C) 2019 Shuah Khan > + * > + */ > + > +/* > + * This file defines vimc driver device and sub-device structures. > + */ > + > +#ifndef _VIMC_H_ > +#define _VIMC_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "vimc-common.h" > + > +struct vimc_cap_device { > + struct vimc_ent_device ved; > + struct video_device vdev; > + struct device *dev; > + struct v4l2_pix_format format; > + struct vb2_queue queue; > + struct list_head buf_list; > + /* > + * NOTE: in a real driver, a spin lock must be used to access the > + * queue because the frames are generated from a hardware interruption > + * and the isr is not allowed to sleep. > + * Even if it is not necessary a spinlock in the vimc driver, we > + * use it here as a code reference > + */ > + spinlock_t qlock; > + struct mutex lock; > + u32 sequence; > + struct vimc_stream stream; > +}; > + > +struct vimc_sca_device { > + struct vimc_ent_device ved; > + struct v4l2_subdev sd; > + struct device *dev; > + /* NOTE: the source fmt is the same as the sink > + * with the width and hight multiplied by mult > + */ > + struct v4l2_mbus_framefmt sink_fmt; > + /* Values calculated when the stream starts */ > + u8 *src_frame; > + unsigned int src_line_size; > + unsigned int bpp; > +}; > + > +struct vimc_deb_device { > + struct vimc_ent_device ved; > + struct v4l2_subdev sd; > + struct device *dev; > + /* The active format */ > + struct v4l2_mbus_framefmt sink_fmt; > + u32 src_code; > + void (*set_rgb_src)(struct vimc_deb_device *vdeb, unsigned int lin, > + unsigned int col, unsigned int rgb[3]); > + /* Values calculated when the stream starts */ > + u8 *src_frame; > + const struct vimc_deb_pix_map *sink_pix_map; > + unsigned int sink_bpp; > +}; > + > +struct vimc_sen_device { > + struct vimc_ent_device ved; > + struct v4l2_subdev sd; > + struct device *dev; > + struct tpg_data tpg; > + struct task_struct *kthread_sen; > + u8 *frame; > + /* The active format */ > + struct v4l2_mbus_framefmt mbus_format; > + struct v4l2_ctrl_handler hdl; > +}; > + > +struct vimc_device { > + /* The platform device */ > + struct platform_device pdev; > + > + /* The pipeline configuration */ > + const struct vimc_pipeline_config *pipe_cfg; > + > + /* The Associated media_device parent */ > + struct media_device mdev; > + > + /* Internal v4l2 parent device*/ > + struct v4l2_device v4l2_dev; > + > + /* Subdevices */ > + struct platform_device **subdevs; > +}; > + > +#endif -- Regards, Laurent Pinchart