From: Adam Belay <ambx1@neo.rr.com>
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Cadet PnP Update (3/6)
Date: Sat, 25 Jan 2003 20:15:24 +0000 [thread overview]
Message-ID: <20030125201524.GA12806@neo.rr.com> (raw)
Converts the radio-cadet driver. Once again I don't have the hardware for this.
-Adam
--- a/drivers/media/radio/radio-cadet.c Tue Jan 14 05:58:38 2003
+++ b/drivers/media/radio/radio-cadet.c Fri Jan 17 15:30:12 2003
@@ -1,4 +1,4 @@
-/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
+/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
*
* by Fred Gleason <fredg@wava.com>
* Version 0.3.3
@@ -20,6 +20,9 @@
* Removed dead CONFIG_RADIO_CADET_PORT code
* PnP detection on load is now default (no args necessary)
*
+ * 2002-01-17 Adam Belay <ambx1@neo.rr.com>
+ * Updated to latest pnp code
+ *
*/
#include <linux/module.h> /* Modules */
@@ -30,7 +33,7 @@
#include <asm/uaccess.h> /* copy to/from user */
#include <linux/videodev.h> /* kernel radio structs */
#include <linux/param.h>
-#include <linux/isapnp.h>
+#include <linux/pnp.h>
#define RDS_BUFFER 256
@@ -47,8 +50,6 @@
static int cadet_lock=0;
static int cadet_probe(void);
-static struct pnp_dev *dev = NULL;
-static int isapnp_cadet_probe(void);
/*
* Signal Strength Threshold Values
@@ -152,7 +153,7 @@
*/
outb(curvol,io+1);
cadet_lock--;
-
+
return fifo;
}
@@ -541,22 +542,23 @@
.fops = &cadet_fops,
};
-static int isapnp_cadet_probe(void)
-{
- dev = pnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
- ISAPNP_FUNCTION(0x0c24), NULL);
+static struct pnp_device_id cadet_pnp_devices[] = {
+ /* ADS Cadet AM/FM Radio Card */
+ {.id = "MSM0c24", .driver_data = 0},
+ {.id = ""}
+};
+MODULE_DEVICE_TABLE(pnp, id_table);
+
+static int cadet_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
+{
if (!dev)
return -ENODEV;
- if (pnp_device_attach(dev) < 0)
- return -EAGAIN;
- if (pnp_activate_dev(dev, NULL) < 0) {
- printk ("radio-cadet: pnp configure failed (out of resources?)\n");
- pnp_device_detach(dev);
- return -EIO;
- }
+ /* only support one device */
+ if (io > 0)
+ return -EBUSY;
+
if (!pnp_port_valid(dev, 0)) {
- pnp_device_detach(dev);
return -ENODEV;
}
@@ -567,6 +569,13 @@
return io;
}
+static struct pnp_driver cadet_pnp_driver = {
+ .name = "radio-cadet",
+ .id_table = cadet_pnp_devices,
+ .probe = cadet_pnp_probe,
+ .remove = NULL,
+};
+
static int cadet_probe(void)
{
static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
@@ -597,7 +606,7 @@
* If a probe was requested then probe ISAPnP first (safest)
*/
if (io < 0)
- io = isapnp_cadet_probe();
+ pnp_register_driver(&cadet_pnp_driver);
/*
* If that fails then probe unsafely if probe is requested
*/
@@ -612,16 +621,19 @@
#ifdef MODULE
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
#endif
- return -EINVAL;
+ goto fail;
}
if (!request_region(io,2,"cadet"))
- return -EBUSY;
+ goto fail;
if(video_register_device(&cadet_radio,VFL_TYPE_RADIO,radio_nr)==-1) {
release_region(io,2);
- return -EINVAL;
+ goto fail;
}
printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io);
return 0;
+fail:
+ pnp_unregister_driver(&cadet_pnp_driver);
+ return -1;
}
@@ -634,21 +646,11 @@
MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)");
MODULE_PARM(radio_nr, "i");
-static struct isapnp_device_id id_table[] __devinitdata = {
- { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
- ISAPNP_VENDOR('M','S','M'), ISAPNP_FUNCTION(0x0c24), 0 },
- {0}
-};
-
-MODULE_DEVICE_TABLE(isapnp, id_table);
-
static void __exit cadet_cleanup_module(void)
{
video_unregister_device(&cadet_radio);
release_region(io,2);
-
- if (dev)
- pnp_device_detach(dev);
+ pnp_unregister_driver(&cadet_pnp_driver);
}
module_init(cadet_init);
reply other threads:[~2003-01-26 1:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030125201524.GA12806@neo.rr.com \
--to=ambx1@neo.rr.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.