Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: ccs: Fix a (harmless) lockdep warning

The v4l2_subdev_init_finalize() is a macro that creates an unique lockdep
key and name. As the CCS driver initialises all three of its sub-devices
using the same call site, this creates a lockdep warning. Address it.

Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Sakari Ailus and committed by
Hans Verkuil
827804d6 256b7767

+12 -5
+12 -5
drivers/media/i2c/ccs/ccs-core.c
··· 2955 2955 2956 2956 static int ccs_init_subdev(struct ccs_sensor *sensor, 2957 2957 struct ccs_subdev *ssd, const char *name, 2958 - unsigned short num_pads, u32 function) 2958 + unsigned short num_pads, u32 function, 2959 + const char *lock_name, 2960 + struct lock_class_key *lock_key) 2959 2961 { 2960 2962 struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); 2961 2963 int rval; ··· 2995 2993 return rval; 2996 2994 } 2997 2995 2998 - rval = v4l2_subdev_init_finalize(&ssd->sd); 2996 + rval = __v4l2_subdev_init_finalize(&ssd->sd, lock_name, lock_key); 2999 2997 if (rval) { 3000 2998 media_entity_cleanup(&ssd->sd.entity); 3001 2999 return rval; ··· 3208 3206 3209 3207 static int ccs_probe(struct i2c_client *client) 3210 3208 { 3209 + static struct lock_class_key pixel_array_lock_key, binner_lock_key, 3210 + scaler_lock_key; 3211 3211 const struct ccs_device *ccsdev = device_get_match_data(&client->dev); 3212 3212 struct ccs_sensor *sensor; 3213 3213 const struct firmware *fw; ··· 3493 3489 } 3494 3490 3495 3491 rval = ccs_init_subdev(sensor, sensor->scaler, " scaler", 2, 3496 - MEDIA_ENT_F_PROC_VIDEO_SCALER); 3492 + MEDIA_ENT_F_PROC_VIDEO_SCALER, 3493 + "ccs scaler mutex", &scaler_lock_key); 3497 3494 if (rval) 3498 3495 goto out_cleanup; 3499 3496 rval = ccs_init_subdev(sensor, sensor->binner, " binner", 2, 3500 - MEDIA_ENT_F_PROC_VIDEO_SCALER); 3497 + MEDIA_ENT_F_PROC_VIDEO_SCALER, 3498 + "ccs binner mutex", &binner_lock_key); 3501 3499 if (rval) 3502 3500 goto out_cleanup; 3503 3501 rval = ccs_init_subdev(sensor, sensor->pixel_array, " pixel_array", 1, 3504 - MEDIA_ENT_F_CAM_SENSOR); 3502 + MEDIA_ENT_F_CAM_SENSOR, "ccs pixel array mutex", 3503 + &pixel_array_lock_key); 3505 3504 if (rval) 3506 3505 goto out_cleanup; 3507 3506