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

media: v4l2-common: v4l2_spi_subdev_init : generate unique name

While v4l2_i2c_subdev_init does give a unique name to the subdev, matching
the one appearing in dmesg for messages generated by dev_info and friends
(e.g. imx185 30-0010), v4l2_spi_subdev_init does a poor job, copying only
the driver name, but not the dev_name(), yielding e.g. "imx185", but
missing the "spi1.1" part, and not generating a unique name.

Fix that.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Philippe De Muyter and committed by
Mauro Carvalho Chehab
447d6685 c4189ffb

+2 -1
+2 -1
drivers/media/v4l2-core/v4l2-common.c
··· 255 255 v4l2_set_subdevdata(sd, spi); 256 256 spi_set_drvdata(spi, sd); 257 257 /* initialize name */ 258 - strscpy(sd->name, spi->dev.driver->name, sizeof(sd->name)); 258 + snprintf(sd->name, sizeof(sd->name), "%s %s", 259 + spi->dev.driver->name, dev_name(&spi->dev)); 259 260 } 260 261 EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init); 261 262