aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/sn9c102
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-10-08 15:26:13 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 23:03:14 -0400
commit54bd5b66c87d14e250f108aad1228b905d6882f6 (patch)
tree2ecb78046819e2c9da176a74e4e9fbc8097031be /drivers/media/video/sn9c102
parentd4cae5a50021271b9ef4e5e39e71e177d12fa8cb (diff)
V4L/DVB (6293): V4L: convert struct class_device to struct device
The currently used "struct class_device" will be removed from the kernel. Here is a patch that converts all users in drivers/media/video/ to struct device. Reviewed-by: Thierry Merle <thierry.merle@free.fr> Reviewed-by: Mike Isely <isely@pobox.com> Reviewed-by: Luca Risolia <luca.risolia@studio.unibo.it> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/sn9c102')
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c112
1 files changed, 58 insertions, 54 deletions
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index e0accf1b8713..6991e06f7651 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1029,7 +1029,8 @@ static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count)
1029 NOTE 2: buffers are PAGE_SIZE long 1029 NOTE 2: buffers are PAGE_SIZE long
1030*/ 1030*/
1031 1031
1032static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) 1032static ssize_t sn9c102_show_reg(struct device* cd,
1033 struct device_attribute *attr, char* buf)
1033{ 1034{
1034 struct sn9c102_device* cam; 1035 struct sn9c102_device* cam;
1035 ssize_t count; 1036 ssize_t count;
@@ -1053,7 +1054,8 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf)
1053 1054
1054 1055
1055static ssize_t 1056static ssize_t
1056sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) 1057sn9c102_store_reg(struct device* cd, struct device_attribute *attr,
1058 const char* buf, size_t len)
1057{ 1059{
1058 struct sn9c102_device* cam; 1060 struct sn9c102_device* cam;
1059 u16 index; 1061 u16 index;
@@ -1086,7 +1088,8 @@ sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len)
1086} 1088}
1087 1089
1088 1090
1089static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) 1091static ssize_t sn9c102_show_val(struct device* cd,
1092 struct device_attribute *attr, char* buf)
1090{ 1093{
1091 struct sn9c102_device* cam; 1094 struct sn9c102_device* cam;
1092 ssize_t count; 1095 ssize_t count;
@@ -1118,7 +1121,8 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf)
1118 1121
1119 1122
1120static ssize_t 1123static ssize_t
1121sn9c102_store_val(struct class_device* cd, const char* buf, size_t len) 1124sn9c102_store_val(struct device* cd, struct device_attribute *attr,
1125 const char* buf, size_t len)
1122{ 1126{
1123 struct sn9c102_device* cam; 1127 struct sn9c102_device* cam;
1124 u16 value; 1128 u16 value;
@@ -1157,7 +1161,8 @@ sn9c102_store_val(struct class_device* cd, const char* buf, size_t len)
1157} 1161}
1158 1162
1159 1163
1160static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) 1164static ssize_t sn9c102_show_i2c_reg(struct device* cd,
1165 struct device_attribute *attr, char* buf)
1161{ 1166{
1162 struct sn9c102_device* cam; 1167 struct sn9c102_device* cam;
1163 ssize_t count; 1168 ssize_t count;
@@ -1183,7 +1188,8 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf)
1183 1188
1184 1189
1185static ssize_t 1190static ssize_t
1186sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) 1191sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr,
1192 const char* buf, size_t len)
1187{ 1193{
1188 struct sn9c102_device* cam; 1194 struct sn9c102_device* cam;
1189 u16 index; 1195 u16 index;
@@ -1216,7 +1222,8 @@ sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len)
1216} 1222}
1217 1223
1218 1224
1219static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) 1225static ssize_t sn9c102_show_i2c_val(struct device* cd,
1226 struct device_attribute *attr, char* buf)
1220{ 1227{
1221 struct sn9c102_device* cam; 1228 struct sn9c102_device* cam;
1222 ssize_t count; 1229 ssize_t count;
@@ -1253,7 +1260,8 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf)
1253 1260
1254 1261
1255static ssize_t 1262static ssize_t
1256sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len) 1263sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr,
1264 const char* buf, size_t len)
1257{ 1265{
1258 struct sn9c102_device* cam; 1266 struct sn9c102_device* cam;
1259 u16 value; 1267 u16 value;
@@ -1298,7 +1306,8 @@ sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len)
1298 1306
1299 1307
1300static ssize_t 1308static ssize_t
1301sn9c102_store_green(struct class_device* cd, const char* buf, size_t len) 1309sn9c102_store_green(struct device* cd, struct device_attribute *attr,
1310 const char* buf, size_t len)
1302{ 1311{
1303 struct sn9c102_device* cam; 1312 struct sn9c102_device* cam;
1304 enum sn9c102_bridge bridge; 1313 enum sn9c102_bridge bridge;
@@ -1329,16 +1338,16 @@ sn9c102_store_green(struct class_device* cd, const char* buf, size_t len)
1329 case BRIDGE_SN9C102: 1338 case BRIDGE_SN9C102:
1330 if (value > 0x0f) 1339 if (value > 0x0f)
1331 return -EINVAL; 1340 return -EINVAL;
1332 if ((res = sn9c102_store_reg(cd, "0x11", 4)) >= 0) 1341 if ((res = sn9c102_store_reg(cd, attr, "0x11", 4)) >= 0)
1333 res = sn9c102_store_val(cd, buf, len); 1342 res = sn9c102_store_val(cd, attr, buf, len);
1334 break; 1343 break;
1335 case BRIDGE_SN9C103: 1344 case BRIDGE_SN9C103:
1336 case BRIDGE_SN9C105: 1345 case BRIDGE_SN9C105:
1337 case BRIDGE_SN9C120: 1346 case BRIDGE_SN9C120:
1338 if (value > 0x7f) 1347 if (value > 0x7f)
1339 return -EINVAL; 1348 return -EINVAL;
1340 if ((res = sn9c102_store_reg(cd, "0x07", 4)) >= 0) 1349 if ((res = sn9c102_store_reg(cd, attr, "0x07", 4)) >= 0)
1341 res = sn9c102_store_val(cd, buf, len); 1350 res = sn9c102_store_val(cd, attr, buf, len);
1342 break; 1351 break;
1343 } 1352 }
1344 1353
@@ -1347,7 +1356,8 @@ sn9c102_store_green(struct class_device* cd, const char* buf, size_t len)
1347 1356
1348 1357
1349static ssize_t 1358static ssize_t
1350sn9c102_store_blue(struct class_device* cd, const char* buf, size_t len) 1359sn9c102_store_blue(struct device* cd, struct device_attribute *attr,
1360 const char* buf, size_t len)
1351{ 1361{
1352 ssize_t res = 0; 1362 ssize_t res = 0;
1353 u16 value; 1363 u16 value;
@@ -1357,15 +1367,16 @@ sn9c102_store_blue(struct class_device* cd, const char* buf, size_t len)
1357 if (!count || value > 0x7f) 1367 if (!count || value > 0x7f)
1358 return -EINVAL; 1368 return -EINVAL;
1359 1369
1360 if ((res = sn9c102_store_reg(cd, "0x06", 4)) >= 0) 1370 if ((res = sn9c102_store_reg(cd, attr, "0x06", 4)) >= 0)
1361 res = sn9c102_store_val(cd, buf, len); 1371 res = sn9c102_store_val(cd, attr, buf, len);
1362 1372
1363 return res; 1373 return res;
1364} 1374}
1365 1375
1366 1376
1367static ssize_t 1377static ssize_t
1368sn9c102_store_red(struct class_device* cd, const char* buf, size_t len) 1378sn9c102_store_red(struct device* cd, struct device_attribute *attr,
1379 const char* buf, size_t len)
1369{ 1380{
1370 ssize_t res = 0; 1381 ssize_t res = 0;
1371 u16 value; 1382 u16 value;
@@ -1375,14 +1386,16 @@ sn9c102_store_red(struct class_device* cd, const char* buf, size_t len)
1375 if (!count || value > 0x7f) 1386 if (!count || value > 0x7f)
1376 return -EINVAL; 1387 return -EINVAL;
1377 1388
1378 if ((res = sn9c102_store_reg(cd, "0x05", 4)) >= 0) 1389 if ((res = sn9c102_store_reg(cd, attr, "0x05", 4)) >= 0)
1379 res = sn9c102_store_val(cd, buf, len); 1390 res = sn9c102_store_val(cd, attr, buf, len);
1380 1391
1381 return res; 1392 return res;
1382} 1393}
1383 1394
1384 1395
1385static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) 1396static ssize_t sn9c102_show_frame_header(struct device* cd,
1397 struct device_attribute *attr,
1398 char* buf)
1386{ 1399{
1387 struct sn9c102_device* cam; 1400 struct sn9c102_device* cam;
1388 ssize_t count; 1401 ssize_t count;
@@ -1401,72 +1414,63 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf)
1401} 1414}
1402 1415
1403 1416
1404static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, 1417static DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, sn9c102_show_reg, sn9c102_store_reg);
1405 sn9c102_show_reg, sn9c102_store_reg); 1418static DEVICE_ATTR(val, S_IRUGO | S_IWUSR, sn9c102_show_val, sn9c102_store_val);
1406static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, 1419static DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
1407 sn9c102_show_val, sn9c102_store_val); 1420 sn9c102_show_i2c_reg, sn9c102_store_i2c_reg);
1408static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, 1421static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
1409 sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); 1422 sn9c102_show_i2c_val, sn9c102_store_i2c_val);
1410static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, 1423static DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green);
1411 sn9c102_show_i2c_val, sn9c102_store_i2c_val); 1424static DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue);
1412static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); 1425static DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red);
1413static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); 1426static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL);
1414static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red);
1415static CLASS_DEVICE_ATTR(frame_header, S_IRUGO,
1416 sn9c102_show_frame_header, NULL);
1417 1427
1418 1428
1419static int sn9c102_create_sysfs(struct sn9c102_device* cam) 1429static int sn9c102_create_sysfs(struct sn9c102_device* cam)
1420{ 1430{
1421 struct class_device *classdev = &(cam->v4ldev->class_dev); 1431 struct device *classdev = &(cam->v4ldev->class_dev);
1422 int err = 0; 1432 int err = 0;
1423 1433
1424 if ((err = class_device_create_file(classdev, &class_device_attr_reg))) 1434 if ((err = device_create_file(classdev, &dev_attr_reg)))
1425 goto err_out; 1435 goto err_out;
1426 if ((err = class_device_create_file(classdev, &class_device_attr_val))) 1436 if ((err = device_create_file(classdev, &dev_attr_val)))
1427 goto err_reg; 1437 goto err_reg;
1428 if ((err = class_device_create_file(classdev, 1438 if ((err = device_create_file(classdev, &dev_attr_frame_header)))
1429 &class_device_attr_frame_header)))
1430 goto err_val; 1439 goto err_val;
1431 1440
1432 if (cam->sensor.sysfs_ops) { 1441 if (cam->sensor.sysfs_ops) {
1433 if ((err = class_device_create_file(classdev, 1442 if ((err = device_create_file(classdev, &dev_attr_i2c_reg)))
1434 &class_device_attr_i2c_reg)))
1435 goto err_frame_header; 1443 goto err_frame_header;
1436 if ((err = class_device_create_file(classdev, 1444 if ((err = device_create_file(classdev, &dev_attr_i2c_val)))
1437 &class_device_attr_i2c_val)))
1438 goto err_i2c_reg; 1445 goto err_i2c_reg;
1439 } 1446 }
1440 1447
1441 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { 1448 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) {
1442 if ((err = class_device_create_file(classdev, 1449 if ((err = device_create_file(classdev, &dev_attr_green)))
1443 &class_device_attr_green)))
1444 goto err_i2c_val; 1450 goto err_i2c_val;
1445 } else { 1451 } else {
1446 if ((err = class_device_create_file(classdev, 1452 if ((err = device_create_file(classdev, &dev_attr_blue)))
1447 &class_device_attr_blue)))
1448 goto err_i2c_val; 1453 goto err_i2c_val;
1449 if ((err = class_device_create_file(classdev, 1454 if ((err = device_create_file(classdev, &dev_attr_red)))
1450 &class_device_attr_red)))
1451 goto err_blue; 1455 goto err_blue;
1452 } 1456 }
1453 1457
1454 return 0; 1458 return 0;
1455 1459
1456err_blue: 1460err_blue:
1457 class_device_remove_file(classdev, &class_device_attr_blue); 1461 device_remove_file(classdev, &dev_attr_blue);
1458err_i2c_val: 1462err_i2c_val:
1459 if (cam->sensor.sysfs_ops) 1463 if (cam->sensor.sysfs_ops)
1460 class_device_remove_file(classdev, &class_device_attr_i2c_val); 1464 device_remove_file(classdev, &dev_attr_i2c_val);
1461err_i2c_reg: 1465err_i2c_reg:
1462 if (cam->sensor.sysfs_ops) 1466 if (cam->sensor.sysfs_ops)
1463 class_device_remove_file(classdev, &class_device_attr_i2c_reg); 1467 device_remove_file(classdev, &dev_attr_i2c_reg);
1464err_frame_header: 1468err_frame_header:
1465 class_device_remove_file(classdev, &class_device_attr_frame_header); 1469 device_remove_file(classdev, &dev_attr_frame_header);
1466err_val: 1470err_val:
1467 class_device_remove_file(classdev, &class_device_attr_val); 1471 device_remove_file(classdev, &dev_attr_val);
1468err_reg: 1472err_reg:
1469 class_device_remove_file(classdev, &class_device_attr_reg); 1473 device_remove_file(classdev, &dev_attr_reg);
1470err_out: 1474err_out:
1471 return err; 1475 return err;
1472} 1476}