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

media: staging/cxd2099: Add module parameter for buffer mode

The buffer mode of the cxd2099 driver requires more work regarding error
handling and thus can cause issues in some cases, so disable it by default
and make that mode of operation controllable by users via a module
parameter (ie. 'modprobe cxd2099 buffermode=1' enables current behaviour).

The upstream codebase also has the buffer mode disabled by default, so
we should match this (but users still can test things out using the
modparm).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Daniel Scheller and committed by
Mauro Carvalho Chehab
2b64e4de b5967860

+11 -10
+11 -10
drivers/staging/media/cxd2099/cxd2099.c
··· 33 33 34 34 #include "cxd2099.h" 35 35 36 - /* comment this line to deactivate the cxd2099ar buffer mode */ 37 - #define BUFFER_MODE 1 36 + static int buffermode; 37 + module_param(buffermode, int, 0444); 38 + MODULE_PARM_DESC(buffermode, "Enable use of the CXD2099AR buffer mode (default: disabled)"); 38 39 39 40 static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount); 40 41 ··· 222 221 return write_regm(ci, reg, val, 0xff); 223 222 } 224 223 225 - #ifdef BUFFER_MODE 226 224 static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n) 227 225 { 228 226 int status = 0; ··· 248 248 } 249 249 return status; 250 250 } 251 - #endif 252 251 253 252 static void set_mode(struct cxd *ci, int mode) 254 253 { ··· 641 642 return len; 642 643 } 643 644 644 - #ifdef BUFFER_MODE 645 - 646 645 static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) 647 646 { 648 647 struct cxd *ci = ca->data; ··· 655 658 mutex_unlock(&ci->lock); 656 659 return ecount; 657 660 } 658 - #endif 659 661 660 662 static struct dvb_ca_en50221 en_templ = { 661 663 .read_attribute_mem = read_attribute_mem, ··· 665 669 .slot_shutdown = slot_shutdown, 666 670 .slot_ts_enable = slot_ts_enable, 667 671 .poll_slot_status = poll_slot_status, 668 - #ifdef BUFFER_MODE 669 672 .read_data = read_data, 670 673 .write_data = write_data, 671 - #endif 672 - 673 674 }; 674 675 675 676 struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, ··· 696 703 ci->en.data = ci; 697 704 init(ci); 698 705 dev_info(&i2c->dev, "Attached CXD2099AR at %02x\n", ci->cfg.adr); 706 + 707 + if (!buffermode) { 708 + ci->en.read_data = NULL; 709 + ci->en.write_data = NULL; 710 + } else { 711 + dev_info(&i2c->dev, "Using CXD2099AR buffer mode"); 712 + } 713 + 699 714 return &ci->en; 700 715 } 701 716 EXPORT_SYMBOL(cxd2099_attach);