From: Osamu Tomita <tomita@cinet.co.jp>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (2/20) char dev update
Date: Sun, 9 Mar 2003 13:13:43 +0900 [thread overview]
Message-ID: <20030309041343.GC1231@yuzuki.cinet.co.jp> (raw)
In-Reply-To: <20030309035245.GA1231@yuzuki.cinet.co.jp>
This is the patch to support NEC PC-9800 subarchitecture
against 2.5.64-ac3. (2/20)
Updates real time clock driver and printer driver for PC98.
- drivers/char/lp_old98.c
used 'ndelay()' and some small cleanup.
- drivers/char/upd4990a.c
remove own BCD macros by using 'linux/bcd.h'.
C99 intializer.
Regards,
Osamu Tomita
diff -Nru linux-2.5.64-ac1/drivers/char/lp_old98.c linux98-2.5.64/drivers/char/lp_old98.c
--- linux-2.5.64-ac1/drivers/char/lp_old98.c 2003-03-07 08:52:01.000000000 +0900
+++ linux98-2.5.64/drivers/char/lp_old98.c 2003-03-05 13:23:48.000000000 +0900
@@ -68,7 +68,7 @@
.wait = LP_INIT_WAIT,
};
-static int dc1_check = 0;
+static int dc1_check;
static spinlock_t lp_old98_lock = SPIN_LOCK_UNLOCKED;
@@ -139,7 +139,7 @@
if (tmp < 0)
tmp = -tmp;
#endif
- __const_udelay(lp.wait * 4);
+ ndelay(lp.wait);
/* negate PSTB# (activate strobe) */
outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL);
@@ -150,7 +150,7 @@
lp.stats.chars ++;
#endif
- __const_udelay(lp.wait * 4);
+ ndelay(lp.wait);
/* assert PSTB# (deactivate strobe) */
outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL);
@@ -488,18 +488,18 @@
errmsg = "unable to register device";
release_region(LP_PORT_EXTMODE, 1);
- err5:
+err5:
release_region(LP_PORT_STROBE, 1);
- err4:
+err4:
release_region(LP_PORT_STATUS, 1);
- err3:
+err3:
release_region(LP_PORT_DATA, 1);
- err2:
+err2:
#ifdef PC98_HW_H98
if (pc98_hw_flags & PC98_HW_H98)
release_region(LP_PORT_H98MODE, 1);
- err1:
+err1:
#endif
printk(KERN_ERR "lp_old98: %s\n", errmsg);
return -EBUSY;
diff -Nru linux-2.5.64-ac1/drivers/char/upd4990a.c linux98-2.5.64/drivers/char/upd4990a.c
--- linux-2.5.64-ac1/drivers/char/upd4990a.c 2003-03-07 08:52:02.000000000 +0900
+++ linux98-2.5.64/drivers/char/upd4990a.c 2003-03-05 13:23:48.000000000 +0900
@@ -24,6 +24,7 @@
#include <linux/ioport.h>
#include <linux/fcntl.h>
#include <linux/rtc.h>
+#include <linux/bcd.h>
#include <linux/upd4990a.h>
#include <linux/init.h>
#include <linux/poll.h>
@@ -34,9 +35,6 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-#define BCD_TO_BINARY(val) (((val) >> 4) * 10 + ((val) & 0xF))
-#define BINARY_TO_BCD(val) ((((val) / 10) << 4) | ((val) % 10))
-
/*
* We sponge a minor off of the misc major. No need slurping
* up another valuable major dev number for this. If you add
@@ -137,7 +135,6 @@
if (data != 0)
break;
-
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
goto out;
@@ -178,7 +175,7 @@
case RTC_UIE_ON: /* Allow ints for RTC updates. */
spin_lock_irq(&rtc_lock);
rtc_irq_data = 0;
- if (!(rtc_status & RTC_UIE_TIMER_ON)){
+ if (!(rtc_status & RTC_UIE_TIMER_ON)) {
rtc_status |= RTC_UIE_TIMER_ON;
rtc_uie_timer.expires = jiffies + 1;
add_timer(&rtc_uie_timer);
@@ -194,10 +191,10 @@
upd4990a_get_time(&raw, 0);
spin_unlock_irq(&rtc_lock);
- wtime.tm_sec = BCD_TO_BINARY(raw.sec);
- wtime.tm_min = BCD_TO_BINARY(raw.min);
- wtime.tm_hour = BCD_TO_BINARY(raw.hour);
- wtime.tm_mday = BCD_TO_BINARY(raw.mday);
+ wtime.tm_sec = BCD2BIN(raw.sec);
+ wtime.tm_min = BCD2BIN(raw.min);
+ wtime.tm_hour = BCD2BIN(raw.hour);
+ wtime.tm_mday = BCD2BIN(raw.mday);
wtime.tm_mon = raw.mon - 1; /* convert to 0-base */
wtime.tm_wday = raw.wday;
@@ -205,7 +202,7 @@
* Account for differences between how the RTC uses the values
* and how they are defined in a struct rtc_time;
*/
- if ((wtime.tm_year = BCD_TO_BINARY(raw.year)) < 95)
+ if ((wtime.tm_year = BCD2BIN(raw.year)) < 95)
wtime.tm_year += 100;
wtime.tm_isdst = 0;
@@ -244,13 +241,13 @@
if (wtime.tm_wday > 6)
return -EINVAL;
- raw.sec = BINARY_TO_BCD(wtime.tm_sec);
- raw.min = BINARY_TO_BCD(wtime.tm_min);
- raw.hour = BINARY_TO_BCD(wtime.tm_hour);
- raw.mday = BINARY_TO_BCD(wtime.tm_mday);
+ raw.sec = BIN2BCD(wtime.tm_sec);
+ raw.min = BIN2BCD(wtime.tm_min);
+ raw.hour = BIN2BCD(wtime.tm_hour);
+ raw.mday = BIN2BCD(wtime.tm_mday);
raw.mon = wtime.tm_mon + 1;
raw.wday = wtime.tm_wday;
- raw.year = BINARY_TO_BCD(wtime.tm_year % 100);
+ raw.year = BIN2BCD(wtime.tm_year % 100);
spin_lock_irq(&rtc_lock);
upd4990a_set_time(&raw, 0);
@@ -329,7 +326,6 @@
static struct file_operations rtc_fops = {
.owner = THIS_MODULE,
- .llseek = no_llseek,
.read = rtc_read,
.poll = rtc_poll,
.ioctl = rtc_ioctl,
@@ -340,9 +336,9 @@
static struct miscdevice rtc_dev=
{
- RTC_MINOR,
- "rtc",
- &rtc_fops
+ .minor = RTC_MINOR,
+ .name = "rtc",
+ .fops = &rtc_fops,
};
static int __init rtc_init(void)
@@ -370,7 +366,6 @@
module_init (rtc_init);
-#ifdef MODULE
static void __exit rtc_exit(void)
{
del_timer(&rtc_uie_timer);
@@ -380,7 +375,6 @@
}
module_exit (rtc_exit);
-#endif
/*
* Info exported via "/proc/driver/rtc".
@@ -400,14 +394,14 @@
* There is no way to tell if the luser has the RTC set for local
* time or for Universal Standard Time (GMT). Probably local though.
*/
- if ((year = BCD_TO_BINARY(data.year) + 1900) < 1995)
+ if ((year = BCD2BIN(data.year) + 1900) < 1995)
year += 100;
p += sprintf(p,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n",
- BCD_TO_BINARY(data.hour), BCD_TO_BINARY(data.min),
- BCD_TO_BINARY(data.sec),
- year, data.mon, BCD_TO_BINARY(data.mday));
+ BCD2BIN(data.hour), BCD2BIN(data.min),
+ BCD2BIN(data.sec),
+ year, data.mon, BCD2BIN(data.mday));
return p - buf;
}
next prev parent reply other threads:[~2003-03-09 4:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-09 3:52 [PATCH] PC-9800 subarch. support for 2.5.64-ac3 Osamu Tomita
2003-03-09 4:12 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (1/20) boot98 update Osamu Tomita
2003-03-09 4:13 ` Osamu Tomita [this message]
2003-03-09 4:14 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (3/20) console Osamu Tomita
2003-03-09 4:16 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (4/20) misc core Osamu Tomita
2003-03-09 4:17 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (5/20) core update Osamu Tomita
2003-03-09 4:18 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (6/20) DMA Osamu Tomita
2003-03-09 4:19 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (7/20) IDE Osamu Tomita
2003-03-09 4:20 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (8/20) input update Osamu Tomita
2003-03-09 4:22 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (9/20) kanji Osamu Tomita
2003-03-09 4:23 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (10/20) kconfig Osamu Tomita
2003-03-09 4:25 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (11/20) NIC Osamu Tomita
2003-03-09 7:15 ` Paul Gortmaker
2003-03-09 9:07 ` Osamu Tomita
2003-03-09 4:26 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (12/20) parport Osamu Tomita
2003-03-09 4:27 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (13/20) PCI Osamu Tomita
2003-03-09 4:28 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (14/20) PCMCIA Osamu Tomita
2003-03-09 4:31 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (15/20) RTC Osamu Tomita
2003-03-09 4:34 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (16/20) SCSI Osamu Tomita
2003-03-12 11:49 ` Geert Uytterhoeven
2003-03-21 7:43 ` Osamu Tomita
2003-03-09 4:35 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (17/20) serial Osamu Tomita
2003-03-09 4:36 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (18/20) setup resources Osamu Tomita
2003-03-09 4:40 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (19/20) SMP Osamu Tomita
2003-03-09 4:42 ` [PATCH] PC-9800 subarch. support for 2.5.64-ac3 (20/20) timer Osamu Tomita
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=20030309041343.GC1231@yuzuki.cinet.co.jp \
--to=tomita@cinet.co.jp \
--cc=alan@lxorguk.ukuu.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®