- Subject: [RFC | PATCH] move device-specific private data out of tuner struct
- From: mrechberger at gmail.com (Markus Rechberger)
- Date: Sat, 2 Jun 2007 12:36:21 +0200
- In-reply-to: <465C8F43.2010906@xxxxxxxxxxx>
@@ -204,6 +204,11 @@ static void set_type(struct i2c_client *
}
#endif
+#if 1
+ /* discard private data, in case set_type() was previously called */
+ kfree(t->priv);
+ t->priv = NULL;
+#endif
at the time of probing priv should be empty and thus a NULL pointer?
(also remove the #if 1/#endif)
cheers
Markus
switch (t->type) {
case TUNER_MT2032:
microtune_init(c);
@@ -496,7 +501,6 @@ static int tuner_attach(struct i2c_adapt
memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
i2c_set_clientdata(&t->i2c, t);
t->type = UNSET;
- t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
t->audmode = V4L2_TUNER_MODE_STEREO;
t->mode_mask = T_UNINITIALIZED;
t->tuner_status = tuner_status;
@@ -616,6 +620,10 @@ static int tuner_detach(struct i2c_clien
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
MOD_DEC_USE_COUNT;
#endif
+ kfree(t->priv);
+#if 0
+ t->priv = NULL;
+#endif
kfree(t);
return 0;
}
On 5/29/07, Michael Krufky <mkrufky at linuxtv.org> wrote:
> As it stands currently, all device-specific data for analog tuner
> drivers are stored in the main tuner struct. This is a potential waste
> of memory for tuner drivers that do not utilize all of these structures.
>
> Up until now, as the needs of the drivers have changed, a developer
> would issue an RFC to explain what he needs to add to the tuner struct
> in order to handle the necessary change for the driver in question.
> With these private structures moved out of the main tuner struct, such
> changes in the future would only affect the specific tuner driver.
>
> I have written a driver for the Philips / NXP TDA18271 silicon tuner.
> This driver needs to maintain a snapshot of the register values in
> memory -- this would be a waste of space for the other tuner drivers, as
> this space would only be needed for the tda18271. Since this memory is
> only needed for the TDA18271, it makes sense that it should be stored in
> a private area specific to the TDA18271, only.
>
> The attached patch allocates these private structures on an as-needed
> basis, within the object code for that specific tuner, rather than
> globally inside the main tuner structure. This change could also be
> considered as a cleanup / overhaul, which brings the tuner.ko module
> closer to an object-oriented design.
>
> Would anybody have any issues with this patch, if it were applied?
>
> Regards,
>
> Mike Krufky
>
>
>
--
Markus Rechberger
[Linux Media]
[Older V4L]
[Linux DVB]
[Video Disk Recorder]
[Asterisk]
[Photo]
[DCCP]
[Netdev]
[Xorg]
[Util Linux NG]
[Xfree86]
[Free Photo Albums]
[Fedora Users]
[Fedora Women]
[ALSA Users]
[ALSA Devel]
[SSH]
[Linux USB]
 |
 |
-->