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

v4l2-core: fix coding style for the two new c files

As I2C and SPI parts of the V4L2 core got split, let's take
the chance and solve the CodingStyle issues there, as reported
by checkpatch --strict.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

+54 -33
+41 -25
drivers/media/v4l2-core/v4l2-i2c.c
··· 28 28 i2c_unregister_device(client); 29 29 } 30 30 31 - void v4l2_i2c_subdev_set_name(struct v4l2_subdev *sd, struct i2c_client *client, 31 + void v4l2_i2c_subdev_set_name(struct v4l2_subdev *sd, 32 + struct i2c_client *client, 32 33 const char *devname, const char *postfix) 33 34 { 34 35 if (!devname) ··· 43 42 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_set_name); 44 43 45 44 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 46 - const struct v4l2_subdev_ops *ops) 45 + const struct v4l2_subdev_ops *ops) 47 46 { 48 47 v4l2_subdev_init(sd, ops); 49 48 sd->flags |= V4L2_SUBDEV_FL_IS_I2C; ··· 58 57 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); 59 58 60 59 /* Load an i2c sub-device. */ 61 - struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, 62 - struct i2c_adapter *adapter, struct i2c_board_info *info, 63 - const unsigned short *probe_addrs) 60 + struct v4l2_subdev 61 + *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, 62 + struct i2c_adapter *adapter, 63 + struct i2c_board_info *info, 64 + const unsigned short *probe_addrs) 64 65 { 65 66 struct v4l2_subdev *sd = NULL; 66 67 struct i2c_client *client; ··· 79 76 else 80 77 client = i2c_new_device(adapter, info); 81 78 82 - /* Note: by loading the module first we are certain that c->driver 83 - will be set if the driver was found. If the module was not loaded 84 - first, then the i2c core tries to delay-load the module for us, 85 - and then c->driver is still NULL until the module is finally 86 - loaded. This delay-load mechanism doesn't work if other drivers 87 - want to use the i2c device, so explicitly loading the module 88 - is the best alternative. */ 89 - if (client == NULL || client->dev.driver == NULL) 79 + /* 80 + * Note: by loading the module first we are certain that c->driver 81 + * will be set if the driver was found. If the module was not loaded 82 + * first, then the i2c core tries to delay-load the module for us, 83 + * and then c->driver is still NULL until the module is finally 84 + * loaded. This delay-load mechanism doesn't work if other drivers 85 + * want to use the i2c device, so explicitly loading the module 86 + * is the best alternative. 87 + */ 88 + if (!client || !client->dev.driver) 90 89 goto error; 91 90 92 91 /* Lock the module so we can safely get the v4l2_subdev pointer */ ··· 96 91 goto error; 97 92 sd = i2c_get_clientdata(client); 98 93 99 - /* Register with the v4l2_device which increases the module's 100 - use count as well. */ 94 + /* 95 + * Register with the v4l2_device which increases the module's 96 + * use count as well. 97 + */ 101 98 if (v4l2_device_register_subdev(v4l2_dev, sd)) 102 99 sd = NULL; 103 100 /* Decrease the module use count to match the first try_module_get. */ 104 101 module_put(client->dev.driver->owner); 105 102 106 103 error: 107 - /* If we have a client but no subdev, then something went wrong and 108 - we must unregister the client. */ 109 - if (client && sd == NULL) 104 + /* 105 + * If we have a client but no subdev, then something went wrong and 106 + * we must unregister the client. 107 + */ 108 + if (client && !sd) 110 109 i2c_unregister_device(client); 111 110 return sd; 112 111 } 113 112 EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); 114 113 115 114 struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, 116 - struct i2c_adapter *adapter, const char *client_type, 117 - u8 addr, const unsigned short *probe_addrs) 115 + struct i2c_adapter *adapter, 116 + const char *client_type, 117 + u8 addr, 118 + const unsigned short *probe_addrs) 118 119 { 119 120 struct i2c_board_info info; 120 121 121 - /* Setup the i2c board info with the device type and 122 - the device address. */ 122 + /* 123 + * Setup the i2c board info with the device type and 124 + * the device address. 125 + */ 123 126 memset(&info, 0, sizeof(info)); 124 127 strscpy(info.type, client_type, sizeof(info.type)); 125 128 info.addr = addr; 126 129 127 - return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); 130 + return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, 131 + probe_addrs); 128 132 } 129 133 EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); 130 134 ··· 146 132 } 147 133 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_addr); 148 134 149 - /* Return a list of I2C tuner addresses to probe. Use only if the tuner 150 - addresses are unknown. */ 135 + /* 136 + * Return a list of I2C tuner addresses to probe. Use only if the tuner 137 + * addresses are unknown. 138 + */ 151 139 const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type) 152 140 { 153 141 static const unsigned short radio_addrs[] = {
+13 -8
drivers/media/v4l2-core/v4l2-spi.c
··· 17 17 } 18 18 19 19 void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, 20 - const struct v4l2_subdev_ops *ops) 20 + const struct v4l2_subdev_ops *ops) 21 21 { 22 22 v4l2_subdev_init(sd, ops); 23 23 sd->flags |= V4L2_SUBDEV_FL_IS_SPI; ··· 29 29 spi_set_drvdata(spi, sd); 30 30 /* initialize name */ 31 31 snprintf(sd->name, sizeof(sd->name), "%s %s", 32 - spi->dev.driver->name, dev_name(&spi->dev)); 32 + spi->dev.driver->name, dev_name(&spi->dev)); 33 33 } 34 34 EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init); 35 35 36 36 struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, 37 - struct spi_master *master, struct spi_board_info *info) 37 + struct spi_master *master, 38 + struct spi_board_info *info) 38 39 { 39 40 struct v4l2_subdev *sd = NULL; 40 41 struct spi_device *spi = NULL; ··· 47 46 48 47 spi = spi_new_device(master, info); 49 48 50 - if (spi == NULL || spi->dev.driver == NULL) 49 + if (!spi || !spi->dev.driver) 51 50 goto error; 52 51 53 52 if (!try_module_get(spi->dev.driver->owner)) ··· 55 54 56 55 sd = spi_get_drvdata(spi); 57 56 58 - /* Register with the v4l2_device which increases the module's 59 - use count as well. */ 57 + /* 58 + * Register with the v4l2_device which increases the module's 59 + * use count as well. 60 + */ 60 61 if (v4l2_device_register_subdev(v4l2_dev, sd)) 61 62 sd = NULL; 62 63 ··· 66 63 module_put(spi->dev.driver->owner); 67 64 68 65 error: 69 - /* If we have a client but no subdev, then something went wrong and 70 - we must unregister the client. */ 66 + /* 67 + * If we have a client but no subdev, then something went wrong and 68 + * we must unregister the client. 69 + */ 71 70 if (!sd) 72 71 spi_unregister_device(spi); 73 72