[PATCH] gpiolib: fix freeing of descriptors on error
When the main loop in linehandle_create() encounters an error, it fails to free one of the previously-requested GPIO descriptors. This renders the unfreed GPIO unusable until reboot, and leaves its label pointing to free'd kernel memory. Cc: sta...@vger.kernel.org Fixes: ab3dbcf78f60 ("gpioib: do not free unrequested descriptors") Signed-off-by: Jim Paris --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e8f8a1999393..a57300c1d649 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -571,7 +571,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) if (ret) goto out_free_descs; lh->descs[i] = desc; - count = i; + count = i + 1; if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW) set_bit(FLAG_ACTIVE_LOW, &desc->flags); -- 2.18.0
Re: [PATCH 0/3] block/ps3vram: Minor updates and fixes
Geoff Levand wrote: > Hi Jens, > > Here are a few minor updates for the ps3vram driver. The third patch adds me > as co-maintainer of the driver, which I think is fitting as I have been > maintaining it for the last few years and expect I would be involved in any > future inquiries regarding it. Thanks Geoff. Acked-by: Jim Paris Jim > > Please apply, thanks. > > -Geoff > > The following changes since commit d4a4f75cd8f29cd9464a5a32e9224a91571d6649: > > Linux 4.1-rc7 (2015-06-07 20:23:50 -0700) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git > for-merge-2 > > for you to fetch changes up to 1d082300a03a735c006739907e6aea082007663c: > > MAINTAINERS: Update ps3vram block driver (2015-06-10 10:46:25 -0700) > > > Geert Uytterhoeven (1): > block/ps3vram: Remove obsolete reference to MTD > > Geoff Levand (2): > block/ps3vram: Fix sparse warnings > MAINTAINERS: Update ps3vram block driver > > MAINTAINERS | 2 ++ > drivers/block/ps3vram.c | 34 +- > 2 files changed, 19 insertions(+), 17 deletions(-) > > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4-real] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Johan Hovold wrote: > On Thu, Oct 30, 2014 at 10:45:38AM -0400, Jim Paris wrote: > > Moved prototype. > > You seem to have posted the old version again. Doh. Fixed. Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..6c358c5e05ab 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; static DEFINE_MUTEX(acm_table_lock); +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + /* * acm_table accessors */ @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Moved prototype. Thanks, Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + static DEFINE_MUTEX(acm_table_lock); /* @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Switched to Johan's suggestion of using a prototype rather than moving acm_tty_set_termios. This depends on his patch in order to get proper DTR handling. Thanks, Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + static DEFINE_MUTEX(acm_table_lock); /* @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Peter Hurley wrote: > Yeah, you're right that the cdc-acm driver isn't properly configuring > the hardware for the current termios settings under all conditions. > > But you don't want to do it for every tty open, only for opens > requiring port initialization, which is what the tty_port->activate() > method is for (ie., acm_port_activate()). I moved it to acm_port_activate(), which works fine. Thanks! acm_tty_set_termios is just moved in this patch, not changed. Jim --- drivers/usb/class/cdc-acm.c | 104 ++-- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..24077deb737a 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -504,6 +504,57 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) return tty_port_open(&acm->port, tty, filp); } +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old) +{ + struct acm *acm = tty->driver_data; + struct ktermios *termios = &tty->termios; + struct usb_cdc_line_coding newline; + int newctrl = acm->ctrlout; + + newline.dwDTERate = cpu_to_le32(tty_get_baud_rate(tty)); + newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0; + newline.bParityType = termios->c_cflag & PARENB ? + (termios->c_cflag & PARODD ? 1 : 2) + + (termios->c_cflag & CMSPAR ? 2 : 0) : 0; + switch (termios->c_cflag & CSIZE) { + case CS5: + newline.bDataBits = 5; + break; + case CS6: + newline.bDataBits = 6; + break; + case CS7: + newline.bDataBits = 7; + break; + case CS8: + default: + newline.bDataBits = 8; + break; + } + /* FIXME: Needs to clear unsupported bits in the termios */ + acm->clocal = ((termios->c_cflag & CLOCAL) != 0); + + if (!newline.dwDTERate) { + newline.dwDTERate = acm->line.dwDTERate; + newctrl &= ~ACM_CTRL_DTR; + } else + newctrl |= ACM_CTRL_DTR; + + if (newctrl != acm->ctrlout) + acm_set_control(acm, acm->ctrlout = newctrl); + + if (memcmp(&acm->line, &newline, sizeof newline)) { + memcpy(&acm->line, &newline, sizeof newline); + dev_dbg(&acm->control->dev, "%s - set line: %d %d %d %d\n", + __func__, + le32_to_cpu(newline.dwDTERate), + newline.bCharFormat, newline.bParityType, + newline.bDataBits); + acm_set_line(acm, &acm->line); + } +} + static void acm_port_dtr_rts(struct tty_port *port, int raise) { struct acm *acm = container_of(port, struct acm, port); @@ -554,6 +605,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ @@ -949,57 +1002,6 @@ static int acm_tty_ioctl(struct tty_struct *tty, return rv; } -static void acm_tty_set_termios(struct tty_struct *tty, - struct ktermios *termios_old) -{ - struct acm *acm = tty->driver_data; - struct ktermios *termios = &tty->termios; - struct usb_cdc_line_coding newline; - int newctrl = acm->ctrlout; - - newline.dwDTERate = cpu_to_le32(tty_get_baud_rate(tty)); - newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0; - newline.bParityType = termios->c_cflag & PARENB ? - (termios->c_cflag & PARODD ? 1 : 2) + - (termios->c_cflag & CMSPAR ? 2 : 0) : 0; - switch (termios->c_cflag & CSIZE) { - case CS5: - newline.bDataBits = 5; - break; - case CS6: - newline.bDataBits = 6; - break; - case CS7: - newline.bDataBits = 7; - break; - case CS8: - default: - newline.bDataBits = 8; - break; - } - /* FIXME: Needs to clear unsupported bits in the termios */ - acm->clocal = ((termios->c_cflag & CLOCAL) != 0); - -
[PATCH] cdc-acm: ensure that termios get set when the port is opened
Do what other drivers like ftdi_sio do, and ensure that termios are written to the device when the port is first opened. Signed-off-by: Jim Paris --- Tested on v3.16.5. I've seen a problem on two CDC-ACM systems based on a Segger J-Link where the port does not get initialized at the correct baudrate when opening (using e.g. python-serial). I think this occurs when the tty device was previously opened at the same baudrate, then the device was unplugged and replugged. While the port is open, manually switching to a different baudrate and back fixes it. Debug output in the failing case is e.g.: Oct 28 18:37:45 pilot kernel: [1214446.586460] tty ttyACM0: acm_tty_install Oct 28 18:37:45 pilot kernel: [1214446.586474] tty ttyACM0: acm_tty_open Oct 28 18:37:45 pilot kernel: [1214446.586477] cdc_acm 1-2.7:1.0: acm_port_activate Oct 28 18:37:45 pilot kernel: [1214446.586670] cdc_acm 1-2.7:1.0: acm_ctrl_msg - rq 0x22, val 0x3, len 0x0, result 0 which is missing the important: Oct 28 19:03:18 pilot kernel: [1215981.178020] cdc_acm 1-2.7:1.0: acm_tty_set_termios - set line: 38400 0 0 8 Oct 28 19:03:18 pilot kernel: [1215981.178135] cdc_acm 1-2.7:1.0: acm_ctrl_msg - rq 0x20, val 0x0, len 0x7, result 7 that I get when changing settings to something different than they previously were. I don't really follow all of the termios and tty stuff, so I don't know if this is the right fix or the real cause. I suspect it have to do with cached values associated with the particular TTY ("lazy saved data" in tty-io.c); this patch just does what I see in ftdi_sio and ensures that the termios settings are written to the device when the port is opened. --- drivers/usb/class/cdc-acm.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..144bf43c9190 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -495,15 +495,6 @@ error_init_termios: return retval; } -static int acm_tty_open(struct tty_struct *tty, struct file *filp) -{ - struct acm *acm = tty->driver_data; - - dev_dbg(tty->dev, "%s\n", __func__); - - return tty_port_open(&acm->port, tty, filp); -} - static void acm_port_dtr_rts(struct tty_port *port, int raise) { struct acm *acm = container_of(port, struct acm, port); @@ -1000,6 +991,18 @@ static void acm_tty_set_termios(struct tty_struct *tty, } } +static int acm_tty_open(struct tty_struct *tty, struct file *filp) +{ + struct acm *acm = tty->driver_data; + + dev_dbg(tty->dev, "%s\n", __func__); + + if (tty) + acm_tty_set_termios(tty, NULL); + + return tty_port_open(&acm->port, tty, filp); +} + static const struct tty_port_operations acm_port_ops = { .dtr_rts = acm_port_dtr_rts, .shutdown = acm_port_shutdown, -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 07/26] block: Use bio_sectors() more consistently
Kent Overstreet wrote: > Bunch of places in the code weren't using it where they could be - > this'll reduce the size of the patch that puts bi_sector/bi_size/bi_idx > into a struct bvec_iter. > > Signed-off-by: Kent Overstreet > CC: Jens Axboe > CC: "Ed L. Cashin" > CC: Nick Piggin > CC: Jiri Kosina > CC: Jim Paris > CC: Geoff Levand > CC: Alasdair Kergon > CC: dm-de...@redhat.com > CC: Neil Brown > CC: Steven Rostedt > --- > drivers/block/aoe/aoecmd.c | 2 +- > drivers/block/brd.c | 3 +-- > drivers/block/pktcdvd.c | 2 +- > drivers/block/ps3vram.c | 2 +- > drivers/md/dm-raid1.c| 2 +- > drivers/md/raid0.c | 6 +++--- > drivers/md/raid1.c | 17 - > drivers/md/raid10.c | 24 +++- > drivers/md/raid5.c | 8 > include/trace/events/block.h | 10 +- > 10 files changed, 36 insertions(+), 40 deletions(-) ... > diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c > index f58cdcf..1ff38e8 100644 > --- a/drivers/block/ps3vram.c > +++ b/drivers/block/ps3vram.c > @@ -553,7 +553,7 @@ static struct bio *ps3vram_do_bio(struct > ps3_system_bus_device *dev, > struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); > int write = bio_data_dir(bio) == WRITE; > const char *op = write ? "write" : "read"; > - loff_t offset = bio->bi_sector << 9; > + loff_t offset = bio_sectors(bio); This doesn't look right to me: bio_sectors(bio) is (bio->bi_size>>9), not (bio->bi_sector<<9~)? -jim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
Tejun Heo wrote: > [please don't drop cc. restored] > > Steen Eugen Poulsen wrote: > >Tejun Heo skrev: > >>All these are caused by smartd. Updating should fix the problem. > > > >Okay, but there is no newer smartd than what I'm using. (5.37) > > Bruce? Original thread can be read from... > > http://thread.gmane.org/gmane.linux.kernel/588972 The fixes were added in smartmontools CVS, but there hasn't been a release since then. -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: NMI error and Intel S5000PSL Motherboards
Hello, > We have about 100 servers based on Intel S5000PSL-SATA motherboards. > They have been running for anywhere between 1 and 10 months. For the > past few months, after updating them all to the 2.6.20.15 kernel > (because of a bug in the 2.6.18 kernel), we are seeing some strange NMI > errors. For example: > > Aug 29 09:02:10 master kernel: Uhhuh. NMI received for unknown reason 30. > Aug 29 09:02:10 master kernel: Do you have a strange power saving mode > enabled? > Aug 29 09:02:10 master kernel: Dazed and confused, but trying to continue I'm also working with Andrew and Samson. It seems that the cause of the problem is CONFIG_PCIEAER, which was introduced after 2.6.18 and defaults to y. With CONFIG_PCIEAER=n, scanpci works fine with no errors. This is the workaround that they'll likely use for now. With CONFIG_PCIEAER=y, scanpci always triggers the NMI error. The option aerdriver.forceload=1 has no effect. The related dmesg output at boot is: Evaluate _OSC Set fails. Status = 0x0005 Evaluate _OSC Set fails. Status = 0x0005 aer_init: AER service init fails - Run ACPI _OSC fails aer: probe of :00:02.0:pcie01 failed with error 2 aer_init: AER service init fails - No ACPI _OSC support aer: probe of :00:03.0:pcie01 failed with error 1 Evaluate _OSC Set fails. Status = 0x0005 Evaluate _OSC Set fails. Status = 0x0005 aer_init: AER service init fails - Run ACPI _OSC fails aer: probe of :00:04.0:pcie01 failed with error 2 Evaluate _OSC Set fails. Status = 0x0005 Evaluate _OSC Set fails. Status = 0x0005 aer_init: AER service init fails - Run ACPI _OSC fails aer: probe of :00:05.0:pcie01 failed with error 2 Evaluate _OSC Set fails. Status = 0x0005 Evaluate _OSC Set fails. Status = 0x0005 aer_init: AER service init fails - Run ACPI _OSC fails aer: probe of :00:06.0:pcie01 failed with error 2 aer_init: AER service init fails - No ACPI _OSC support aer: probe of :00:07.0:pcie01 failed with error 1 Full dmesg, lspci, and ACPI DSDT are available here: http://jim.sh/~jim/tmp/nmi/ -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sata_nv + ADMA + Samsung disk problem
Gabor Gombas wrote: > On Tue, Aug 14, 2007 at 06:30:28PM +0900, Tejun Heo wrote: > > Hmmm... That's timeout on cache flush, indicative of failing disk. > > Please post the result of 'smartctl -a /dev/sdc'. > > Ok, so something is fishy in 2.6.22 wrt. SMART. See http://lkml.org/lkml/2007/7/8/198 -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [2.6.22-rc6] NForce4 soft and hard resetting ports and exceptions
Frederik Himpe wrote: > On Tue, 26 Jun 2007 17:45:22 +, Frederik Himpe wrote: > > > I tried Linux 2.6.22-rc6 on my machine with an Asus A8N-SlI Deluxe > > motherboard (NForce 4 chipset). > > > > When booting, the system hangs for a long time, but it continues after a > > long wait. I found these kind of errors in the logs afterwards: > > [...] > > > With Linux 2.6.21 this did not happen. > > > > config, dmesg and lspci can be found here: > > http://artipc10.vub.ac.be/kernelbug/ > > After disabling hddtemp and smartd services, these errors do not happen > anymore. This was a bug in smartmontools. It is fixed in CVS and should be in the next released version. http://article.gmane.org/gmane.linux.utilities.smartmontools/4621 -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [2.6.21.1] SATA freeze
> > This appears to be a different problem. Something is issuing SMART-related > > commands (smartd or smartctl perhaps) which the drive seems to be reacting > > strangely to. .. > Specifically, I could trigger it by running 'smartctl -d ata -S on > /dev/sda' OR (s-S/o/). This sounds like a known bug in smartmontools: http://marc.info/?l=smartmontools-support&m=117203137719518 http://www.mail-archive.com/[EMAIL PROTECTED]/msg03160.html -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Silent corruption on AMD64
Aaron Lehmann wrote: > I discovered a reproducible way of causing silent file corruption. ... > 1. Heavy Ethernet load (nc remotehost < /dev/zero) > 2. Heavy disk write load on any non-sata_sil drive (cat /dev/zero > /path) > 3. Heavy disk read load on any other drive (tar c /path | cat > /dev/null) Since it shows up under heavy load that includes unrelated devices, I think ruling out hardware problems is important. Some suggestions: - Use mcelog to see if you're getting any machine check exceptions that would indicate hardware error: http://freshmeat.net/projects/mcelog/ - Use the edac module to turn on pci parity and memory error checks: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/drivers/edac/edac.txt - Run memtest86+ for several loops to make sure your RAM is ok - Try moving the SiI card to a different slot - Try running the SATA drives from a separate power supply - Move disks and cables around to see whether the problem follows the disks, the cables, or the controllers - Try enabling the "spread spectrum" clock option in your BIOS to reduce EMI -jim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Digiboard EPCA driver for 2.4
8 15:10:15 2000 +++ epca-1.4.5.1-jim/drv/Makefile Sun Mar 11 14:17:09 2001 @@ -1,5 +1,5 @@ -CFLAGS = -O2 -D__KERNEL__ -DMODULE -DLINUX -DKERNEL2_0 -Wall -I/usr/src/linux/include +CFLAGS += -D__KERNEL__ -DMODULE -DLINUX -Wall -I/usr/src/linux/include LDFLAGS = -s -N CC=cc diff -Naur epca-1.4.5-1/drv/epca.c epca-1.4.5.1-jim/drv/epca.c --- epca-1.4.5-1/drv/epca.c Wed Jun 28 16:01:43 2000 +++ epca-1.4.5.1-jim/drv/epca.c Sun Mar 11 14:57:16 2001 @@ -461,6 +461,9 @@ were using it wrong in a few instances, and it was causing problems in newer redhat versions. -- Changed version number to 1.4.5-1 +March 11, 2001: [EMAIL PROTECTED] + -- Support for 2.4 and devfs added by Jim Paris <[EMAIL PROTECTED]>. + -- Changed version number to 1.4.5.1-jim -- */ #ifdef MODULE @@ -580,7 +583,7 @@ #include "epcaconfig.h" /* -- Begin defines */ -#define VERSION"1.4.5-1" +#define VERSION"1.4.5.1-jim" @@ -624,7 +627,11 @@ #ifdef KERNEL2_x static int pc_timeron = 0; +#if LINUX_VERSION_CODE > 0x020400 +static struct timer_list pc_timer = { {NULL, NULL}, 0, 0, 0}; +#else static struct timer_list pc_timer = {NULL, NULL, 0, 0, 0}; +#endif #endif /* KERNEL2_x */ @@ -803,7 +810,9 @@ #ifdef KERNEL2_x static int get_termio(struct tty_struct *, struct termio *); static int pc_write(struct tty_struct *, int, const unsigned char *, int); +#if LINUX_VERSION_CODE < 0x020400 static void do_pc_bh(void); +#endif int pc_init(void); #else static int pc_write(struct tty_struct *, int, unsigned char *, int); @@ -842,8 +851,13 @@ #ifdef KERNEL2_x #include +#if LINUX_VERSION_CODE < 0x020400 int epca_read_proc( char *buf, char **start, off_t offset, int len, int unused ){ +#else +int epca_read_proc( char *buf, char **start, off_t offset, int len ){ +#endif + int crd; len=sprintf( buf, "\nEPCA Linux Driver Version %s\n",VERSION); @@ -882,6 +896,7 @@ return len; } +#if LINUX_VERSION_CODE < 0x020400 struct proc_dir_entry epca_proc_entry = { 0, /* low_ino: The inode -- dynamic */ 4, "epca", /* len of name and name */ @@ -891,6 +906,7 @@ NULL, /* operations -- use default */ &epca_read_proc,/* function used to read data */ }; +#endif #endif /* KERNEL2_x */ #endif /* CONFIG_PROC_FS */ @@ -1144,6 +1160,9 @@ -*/ ch->event |= 1 << event; + +#if LINUX_VERSION_CODE < 0x020400 + #if (LINUX_VERSION_CODE >= 0x020100) queue_task(&ch->tqueue, &tq_epca); #else @@ -1155,6 +1174,11 @@ can see. ---*/ mark_bh(DIGI_BH); +#else /* kernel 2.4 */ + MOD_INC_USE_COUNT; + if(schedule_task(&ch->tqueue)==0) + MOD_DEC_USE_COUNT; +#endif } /* End pc_sched_event */ @@ -1413,7 +1437,9 @@ -- */ /* Prevent future Digi programmed interrupts from coming active */ +#if LINUX_VERSION_CODE < 0x020400 disable_bh(DIGI_BH); +#endif ch->asyncflags &= ~ASYNC_INITIALIZED; restore_flags(flags); @@ -2428,8 +2454,12 @@ } if( ch->tmp_buf ) { +#if LINUX_VERSION_CODE < 0x020400 kfree_s(ch->tmp_buf, ch->txbufsize); ch->tmp_buf = NULL; +#else + kfree(ch->tmp_buf); +#endif } } @@ -2450,6 +2480,7 @@ } } +#if LINUX_VERSION_CODE < 0x020400 if (tty_unregister_driver(&pc_callout) ) { epca_mess(KERN_WARNING, "cleanup_module failed to un-register pc_callout driver\n"); } else { @@ -2460,6 +2491,7 @@ if( pc_callout.table ) vfree( pc_callout.table ); } +#endif if (tty_unregister_driver(&pc_info) ) epca_mess(KERN_WARNING, "cleanup_module failed to un-register pc_info driver\n"); @@ -2484,7 +2516,11 @@ #ifdef CONFIG_PROC_FS +#if LINUX_VERSION_CODE < 0x020400 proc_unregister( &proc_root, epca_proc_entry.low_ino); +#else + remove_proc_entry("epca",NULL); +#endif #endif /* CONFIG_PROC_FS */ // Free up the array of tty_driver arrays @@ -2569,7 +2605,10 @@ memory. ---