[linux-dvb] [PATCH] [RFC] remove static dependencies on dvb-pll

Uwe Bugla uwe.bugla at gmx.de
Sat Jun 2 21:09:28 CEST 2007


Am Samstag, 2. Juni 2007 20:15 schrieben Sie:
> Uwe Bugla wrote:
> > Am Samstag, 2. Juni 2007 18:56 schrieben Sie:
> >
> > However, the output applying this against 2.6.22-rc3 causes other
> > trouble:
>
> I told you that it wouldn't apply against 2.6.22-rc3.  The patch was
> generated against the mercurial repository.
>
> > OKIDOK! If you can promise me and others that this is your "final"
> > version I am inclined to do the following now:
>
> This is _not_ the final version of the patch.  There is still one caller
> of dvb_pll_configure (dvb-usb-i2c), and that must be removed before I
> can remove the dvb_pll_configure export, and store the pointer to the
> dvb_pll_desc inside the priv structure, instead of storing the id.
>
> Trent also asked me to convert the #define's into an enum... I think
> that's a good idea, but I have reason not to do that yet.  (some other
> patches in my sandbox here depend on those being integer -- I havent yet
> decided whether or not to share those patches yet)
>
> > 1. Adjust your work for being applied against 2.6.22-rc3
>
> ^^^ Please don't.  This patch is _not_ intended for 2.6.22-rc3.  I have
> some other cleanups to do, and I only shared this patch with you because
> of your complaining on the mailing list.  I have shown you this patch,
> because I nacked your other patch, which made you upset.  You wanted me
> to provide an alternate solution.  Showing you this patch was my
> "proof-of-concept", and this was my way to show you that I have a better
> solution, and it will be applied to the repository, when the time comes,
> provided that the other dvb developers are OK with it.
>
> > 2. Test your work
>
> By all means, please feel free to test it against the mercurial repository.
>
> > 3. Send it in again in a corrected version (without offsets, rejects and
> > fuzz factors plus the pre-condition of having applied Trent's work for
> > dst customization before applying your stuff).
>
> ^^^ Please don't.  This is my work, and I will see it through, myself.
>
> > You've offered lots of help now for which I am very thankful.
> > So please have some patience and let me do the rest, OK?
>
> Apply it to your own tree and do whatever testing you like.  This patch
> is _not_ for mainline... at least not yet.  As I have explained above,
> when I am ready to include this patch, I will ask the relevant
> maintainers for their acks, and I will have it pushed into the master
> repository, where it can receive sufficient testing before the 2.6.23
> merge window opens.
>
> I feel strongly against rushing in a patch without being sure that all
> approve of it.  Since this patch touches functionality that many
> developers have had their hands in, it is only fair to give them all
> sufficient time to look it over.
>
> > There is no discussion that your work (plus Trent's inputs of course) is
> > far more better than mine or Markus's.
> >
> >> The patch was generated against v4l-dvb.hg ... I can't promise that it
> >> will apply cleanly against 2.6.22-rc3, although I see no reason why
> >> not...  You may run into a hunk failure when it comes to dvb_pll_desc
> >> *dvb_pll_opera1.
> >>
> >> Cheers,
> >>
> >> Mike
> >
> > Best Regards and Thanks
> >
> > Uwe
> >
> > P. S.: I still do not understand the essence of this pll library as far
> > as - performance
> > - stability
> > - other functionalities
>
> To make a long story short, the devices supported by the dvb-pll library
> are similar enough that, through some abstraction, a single module
> library is able to support a wide variety of devices.  The performance
> if the driver leaves nothing to be desired.  It is stable, and functions
> as well as it needs to.
>
> The only downside to this module is that it forces all supported devices
> to fit into a certain criteria, and some (many) devices are too complex
> to be supported by dvb-pll.  When such a device shows up, we either
> extend the functionality of dvb-pll to be able to support the additional
> feature, or we create a new, separate module to handle the new device.
>
> > are concerned. Would be really keen on understanding the theoretical
> > background / use of this Gerd-Knorr-relic.
>
> Please drop this now.  I do not care to get into this discussion.  There
> is no reason to point more fingers at any more people.
>
> -Mike

Ok, Mike. All accepted so far!

Did two things:

Applied your patch against Mercurial tree - satisfies my needs for now.
Adapted the dst-customization stuff for latest mercurial needs and applied it:

For people who need it to be applied against Mercurial, here is the result:

--- a/linux/drivers/media/dvb/bt8xx/dst.c Fri Apr 27 12:16:31 2007
+++ b/linux/drivers/media/dvb/bt8xx/dst.c Mon May 28 19:46:33 2007
@@ -1732,12 +1732,22 @@ static void dst_release(struct dvb_front
 static struct dvb_frontend_ops dst_dvbc_ops;
 static struct dvb_frontend_ops dst_atsc_ops;
 
-struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter 
*dvb_adapter)
-{
+struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878 *bt,
+ struct i2c_adapter *i2c)
+{
+struct dst_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
+
+	if (!state) {
+	printk(KERN_ERR "dst: No memory!\n");
+	return NULL;;
+	}
+	state->i2c = i2c;
+	state->config = config;
+	state->bt = bt;
+
 	/* check if the ASIC is there */
 	if (dst_probe(state) < 0) {
-		kfree(state);
-		return NULL;
+		goto fail;
 	}
 	/* determine settings based on type */
 	/* create dvb_frontend */
@@ -1756,12 +1766,15 @@ struct dst_state *dst_attach(struct dst_
 		break;
 	default:
 		dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the 
LinuxTV.org DVB mailinglist.");
-		kfree(state);
-		return NULL;
+		goto fail;
 	}
 	state->frontend.demodulator_priv = state;
 
-	return state;				/*	Manu (DST is a card not a frontend)	*/
+	return &state->frontend; /* Manu (DST is a card not a frontend) */
+
+	fail:
+	kfree(state);
+	return NULL;
 }
 
 EXPORT_SYMBOL(dst_attach);
--- a/linux/drivers/media/dvb/bt8xx/dst_ca.c Fri Apr 27 12:16:31 2007
+++ b/linux/drivers/media/dvb/bt8xx/dst_ca.c Mon May 28 19:47:33 2007
@@ -795,8 +795,9 @@ static struct dvb_device dvbdev_ca = {
 	.fops = &dst_ca_fops
 };
 
-struct dvb_device *dst_ca_attach(struct dst_state *dst, struct dvb_adapter 
*dvb_adapter)
-{
+struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct dvb_adapter 
*dvb_adapter)
+{
+	struct dst_state *dst = fe->demodulator_priv;
 	struct dvb_device *dvbdev;
 
 	dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
--- a/linux/drivers/media/dvb/bt8xx/dst_common.h Fri Apr 27 12:16:31 2007
+++ b/linux/drivers/media/dvb/bt8xx/dst_common.h Mon May 28 19:47:33 2007
@@ -184,11 +184,25 @@ int write_dst(struct dst_state *state, u
 int write_dst(struct dst_state *state, u8 * data, u8 len);
 int read_dst(struct dst_state *state, u8 * ret, u8 len);
 u8 dst_check_sum(u8 * buf, u32 len);
-struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter 
*dvb_adapter);
-struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter 
*dvb_adapter);
-int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, 
int delay);
-
-int dst_command(struct dst_state* state, u8 * data, u8 len);
-
-
+int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, 
int delay);
+int dst_command(struct dst_state* state, u8 * data, u8 len);
+
+#if defined(CONFIG_DVB_DST) || (defined(CONFIG_DVB_DST_MODULE) && 
defined(MODULE))
+struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878 *bt,
+struct i2c_adapter *i2c);
+struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct dvb_adapter 
*dvb_adapter);
+#else
+static inline struct dvb_frontend *dst_attach(struct dst_config *config,
+ struct bt878 *bt, struct i2c_adapter *i2c)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
+ return NULL;
+}
+static inline struct dvb_device *dst_ca_attach(struct dvb_frontend *fe,
+ struct dvb_adapter *dvb_adapter)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
+ return NULL;
+}
+#endif // CONFIG_DVB_DST
 #endif // DST_COMMON_H
--- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c Fri Apr 27 12:16:31 2007
+++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c Mon May 28 19:47:33 2007
@@ -660,26 +660,17 @@ static void frontend_init(struct dvb_bt8
 
 	case BTTV_BOARD_TWINHAN_DST:
 		/*	DST is not a frontend driver !!!		*/
-		state = kmalloc(sizeof (struct dst_state), GFP_KERNEL);
-		if (!state) {
-			printk("dvb_bt8xx: No memory\n");
-			break;
-		}
-		/*	Setup the Card					*/
-		state->config = &dst_config;
-		state->i2c = card->i2c_adapter;
-		state->bt = card->bt;
-		state->dst_ca = NULL;
 		/*	DST is not a frontend, attaching the ASIC	*/
-		if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
-			printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
+		card->fe = dvb_attach(dst_attach, &dst_config, card->bt,
+		card->i2c_adapter);
+		if (card->fe != NULL) {
+		printk(KERN_ERR "%s: Could not find a Twinhan DST.\n", __FUNCTION__);
 			break;
 		}
 		/*	Attach other DST peripherals if any		*/
 		/*	Conditional Access device			*/
-		card->fe = &state->frontend;
 		if (state->dst_hw_cap & DST_TYPE_HAS_CA)
-			dvb_attach(dst_ca_attach, state, &card->dvb_adapter);
+			dvb_attach(dst_ca_attach, card->fe, &card->dvb_adapter);
 		break;
 
 	case BTTV_BOARD_PINNACLESAT:
--- a/linux/drivers/media/dvb/bt8xx/Makefile Mon Apr 30 12:39:33 2007
+++ b/linux/drivers/media/dvb/bt8xx/Makefile Thu May 28 19:47:00 2007
@@ -1,3 +1,4 @@ obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-b
-obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o
+obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o
+obj-$(CONFIG_DVB_DST) += dst.o dst_ca.o
 
 EXTRA_CFLAGS 
= -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends
--- a/linux/drivers/media/dvb/bt8xx/Kconfig Mon Apr 30 12:39:33 2007
+++ b/linux/drivers/media/dvb/bt8xx/Kconfig Mon May 28 19:47:00 2007
@@ -9,6 +9,7 @@ config DVB_BT8XX
 	select DVB_LGDT330X if !DVB_FE_CUSTOMISE
 	select DVB_PLL if !DVB_FE_CUSTOMISE
 	select DVB_ZL10353 if !DVB_FE_CUSTOMISE
+	select DVB_DST if !DVB_FE_CUSTOMISE
 	select FW_LOADER
 	help
 	  Support for PCI cards based on the Bt8xx PCI bridge. Examples are
@@ -21,3 +22,11 @@ config DVB_BT8XX
 	  an external software decoder to watch TV on your computer.
 
 	  Say Y if you own such a device and want to use it.
+
+config DVB_DST
+	tristate "Support for TwinHan DST boards (CA) and clones"
+	depends on DVB_BT8XX && DVB_CORE && I2C
+	default m if DVB_FE_CUSTOMISE
+	help
+	  Support for the following boards: TwinHan DST or clones, Pinnacle PCTV Sat 
CI, Chaintech DST-1000, DNTV Live !
+	  Say Y if you own such a device and want to use it.

Thank you Mike! Well done! :)

Also big Thanks to Markus! :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dst.patch
Type: text/x-diff
Size: 6184 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20070602/ec64c684/attachment.patch 


More information about the linux-dvb mailing list