Re: [PATCH v2 02/17] smiapp: Explicitly define number of pads in initialisation

2016-09-19 Thread Sebastian Reichel
Hi,

On Thu, Sep 15, 2016 at 02:22:16PM +0300, Sakari Ailus wrote:
> Define the number of pads explicitly in initialising the sub-devices.

Reviewed-By: Sebastian Reichel 

-- Sebastian


signature.asc
Description: PGP signature


[PATCH v2 02/17] smiapp: Explicitly define number of pads in initialisation

2016-09-15 Thread Sakari Ailus
Define the number of pads explicitly in initialising the sub-devices.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 862017e..be74ba3 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2536,7 +2536,8 @@ static void smiapp_cleanup(struct smiapp_sensor *sensor)
 }
 
 static void smiapp_create_subdev(struct smiapp_sensor *sensor,
-struct smiapp_subdev *ssd, const char *name)
+struct smiapp_subdev *ssd, const char *name,
+unsigned short num_pads)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
 
@@ -2545,12 +2546,8 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
 
ssd->sensor = sensor;
 
-   if (ssd == sensor->pixel_array) {
-   ssd->npads = 1;
-   } else {
-   ssd->npads = 2;
-   ssd->source_pad = 1;
-   }
+   ssd->npads = num_pads;
+   ssd->source_pad = num_pads - 1;
 
snprintf(ssd->sd.name,
 sizeof(ssd->sd.name), "%s %s %d-%4.4x", sensor->minfo.name,
@@ -2745,9 +2742,9 @@ static int smiapp_init(struct smiapp_sensor *sensor)
pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS;
 
if (sensor->scaler)
-   smiapp_create_subdev(sensor, sensor->scaler, "scaler");
-   smiapp_create_subdev(sensor, sensor->binner, "binner");
-   smiapp_create_subdev(sensor, sensor->pixel_array, "pixel_array");
+   smiapp_create_subdev(sensor, sensor->scaler, "scaler", 2);
+   smiapp_create_subdev(sensor, sensor->binner, "binner", 2);
+   smiapp_create_subdev(sensor, sensor->pixel_array, "pixel_array", 1);
 
dev_dbg(>dev, "profile %d\n", sensor->minfo.smiapp_profile);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html