aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-03 11:08:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-03 11:08:44 -0500
commitc1dcb4bb1e3e16e9baee578d9bb040e5fba1063e (patch)
tree1bba995740aed8ef9a47111c1ee6ceeda84af836 /drivers/media
parent60f8a8d4c6c46bb080e8e65d30be31b172a39a78 (diff)
parent6fdb2ee243404c7cbf530387bf904ad1841ebf5b (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (23 commits) firewire: ohci: extend initialization log message firewire: ohci: fix IR/IT context mask mixup firewire: ohci: add module parameter to activate quirk fixes firewire: ohci: use an ID table for quirks detection firewire: ohci: reorder struct fw_ohci for better cache efficiency firewire: ohci: remove unused dualbuffer IR code firewire: core: combine a bit of repeated code firewire: core: change type of a data buffer firewire: cdev: increment ABI version number firewire: cdev: add more flexible cycle timer ioctl firewire: core: rename an internal function firewire: core: fix an information leak firewire: core: increase stack size of config ROM reader firewire: core: don't fail device creation in case of too large config ROM blocks firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500 firewire: remove incomplete Bus_Time CSR support firewire: get_cycle_timer optimization and cleanup firewire: ohci: enable cycle timer fix on ALi and NEC controllers firewire: ohci: work around cycle timer bugs on VIA controllers firewire: make PCI device id constant ...
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/firewire/firedtv-fw.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-fw.c b/drivers/media/dvb/firewire/firedtv-fw.c
index 7a3de16fba06..75afe4f81e33 100644
--- a/drivers/media/dvb/firewire/firedtv-fw.c
+++ b/drivers/media/dvb/firewire/firedtv-fw.c
@@ -239,47 +239,18 @@ static const struct fw_address_region fcp_region = {
239}; 239};
240 240
241/* Adjust the template string if models with longer names appear. */ 241/* Adjust the template string if models with longer names appear. */
242#define MAX_MODEL_NAME_LEN ((int)DIV_ROUND_UP(sizeof("FireDTV ????"), 4)) 242#define MAX_MODEL_NAME_LEN sizeof("FireDTV ????")
243
244static size_t model_name(u32 *directory, __be32 *buffer)
245{
246 struct fw_csr_iterator ci;
247 int i, length, key, value, last_key = 0;
248 u32 *block = NULL;
249
250 fw_csr_iterator_init(&ci, directory);
251 while (fw_csr_iterator_next(&ci, &key, &value)) {
252 if (last_key == CSR_MODEL &&
253 key == (CSR_DESCRIPTOR | CSR_LEAF))
254 block = ci.p - 1 + value;
255 last_key = key;
256 }
257
258 if (block == NULL)
259 return 0;
260
261 length = min((int)(block[0] >> 16) - 2, MAX_MODEL_NAME_LEN);
262 if (length <= 0)
263 return 0;
264
265 /* fast-forward to text string */
266 block += 3;
267
268 for (i = 0; i < length; i++)
269 buffer[i] = cpu_to_be32(block[i]);
270
271 return length * 4;
272}
273 243
274static int node_probe(struct device *dev) 244static int node_probe(struct device *dev)
275{ 245{
276 struct firedtv *fdtv; 246 struct firedtv *fdtv;
277 __be32 name[MAX_MODEL_NAME_LEN]; 247 char name[MAX_MODEL_NAME_LEN];
278 int name_len, err; 248 int name_len, err;
279 249
280 name_len = model_name(fw_unit(dev)->directory, name); 250 name_len = fw_csr_string(fw_unit(dev)->directory, CSR_MODEL,
251 name, sizeof(name));
281 252
282 fdtv = fdtv_alloc(dev, &backend, (char *)name, name_len); 253 fdtv = fdtv_alloc(dev, &backend, name, name_len >= 0 ? name_len : 0);
283 if (!fdtv) 254 if (!fdtv)
284 return -ENOMEM; 255 return -ENOMEM;
285 256