History

[media] lirc_zilog: Move constants from ir_probe() into the lirc_driver template

ir_probe() makes a number of constant assignments into the lirc_driver object after copying in a template. Make better use of the template.

Andy Walls committed 15 years ago

Commit 534c1ea1 parent bcbd1651 file · +15 −12Browse files

Showing the changes to drivers/staging/lirc (1 of 1 file). Show all

Unified · Split

drivers/staging/lirc/lirc_zilog.c+15−12
@@ -1116,13 +1116,6 @@ static int close(struct inode *node, struct file *filep) · 1115 unmodified lines
1116 return 0;1116 return 0;
1117}1117}
1118 1118
1119static struct lirc_driver lirc_template = {
1120 .name = "lirc_zilog",
1121 .set_use_inc = set_use_inc,
1122 .set_use_dec = set_use_dec,
1123 .owner = THIS_MODULE
1124};
1125
1126static int ir_remove(struct i2c_client *client);1119static int ir_remove(struct i2c_client *client);
1127static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);1120static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);
1128 1121
@@ -1161,6 +1154,19 @@ static const struct file_operations lirc_fops = { · 32 unmodified lines
1161 .release = close1154 .release = close
1162};1155};
1163 1156
1157static struct lirc_driver lirc_template = {
1158 .name = "lirc_zilog",
1159 .minor = -1,
1160 .code_length = 13,
1161 .buffer_size = BUFLEN / 2,
1162 .sample_rate = 0, /* tell lirc_dev to not start its own kthread */
1163 .chunk_size = 2,
1164 .set_use_inc = set_use_inc,
1165 .set_use_dec = set_use_dec,
1166 .fops = &lirc_fops,
1167 .owner = THIS_MODULE,
1168};
1169
1164static void destroy_rx_kthread(struct IR_rx *rx)1170static void destroy_rx_kthread(struct IR_rx *rx)
1165{1171{
1166 /* end up polling thread */1172 /* end up polling thread */
@@ -1292,14 +1298,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 125 unmodified lines
1292 /* set lirc_dev stuff */1298 /* set lirc_dev stuff */
1293 memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));1299 memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));
1294 ir->l.minor = minor; /* module option */1300 ir->l.minor = minor; /* module option */
1295 ir->l.code_length = 13;
1296 ir->l.chunk_size = 2;
1297 ir->l.buffer_size = BUFLEN / 2;
1298 ir->l.rbuf = &ir->rbuf;1301 ir->l.rbuf = &ir->rbuf;
1299 ir->l.fops = &lirc_fops;
1300 ir->l.data = ir;1302 ir->l.data = ir;
1301 ir->l.dev = &adap->dev;1303 ir->l.dev = &adap->dev;
1302 ir->l.sample_rate = 0;
1303 ret = lirc_buffer_init(ir->l.rbuf,1304 ret = lirc_buffer_init(ir->l.rbuf,
1304 ir->l.chunk_size, ir->l.buffer_size);1305 ir->l.chunk_size, ir->l.buffer_size);
1305 if (ret)1306 if (ret)
@@ -1314,6 +1315,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 8 unmodified lines
1314 goto out_free_xx;1315 goto out_free_xx;
1315 }1316 }
1316 1317
1318 ir->l.features |= LIRC_CAN_SEND_PULSE;
1317 ir->tx->c = client;1319 ir->tx->c = client;
1318 ir->tx->need_boot = 1;1320 ir->tx->need_boot = 1;
1319 ir->tx->post_tx_ready_poll =1321 ir->tx->post_tx_ready_poll =
@@ -1326,6 +1328,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 6 unmodified lines
1326 goto out_free_xx;1328 goto out_free_xx;
1327 }1329 }
1328 1330
1331 ir->l.features |= LIRC_CAN_REC_LIRCCODE;
1329 ir->rx->c = client;1332 ir->rx->c = client;
1330 ir->rx->hdpvr_data_fmt =1333 ir->rx->hdpvr_data_fmt =
1331 (id->driver_data & ID_FLAG_HDPVR) ? true : false;1334 (id->driver_data & ID_FLAG_HDPVR) ? true : false;