Commit 9753b127 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  rtc: rtc-sun4v fixes, revised
  sparc: Fix tty compile warnings.
  sparc: struct device - replace bus_id with dev_name(), dev_set_name()
parents 847e9170 cecf61bd
...@@ -29,10 +29,11 @@ struct termios { ...@@ -29,10 +29,11 @@ struct termios {
tcflag_t c_cflag; /* control mode flags */ tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */ tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */ cc_t c_line; /* line discipline */
#ifndef __KERNEL__
cc_t c_cc[NCCS]; /* control characters */ cc_t c_cc[NCCS]; /* control characters */
#ifdef __KERNEL__ #else
cc_t c_cc[NCCS+2]; /* kernel needs 2 more to hold vmin/vtime */
#define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t)) #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
cc_t _x_cc[2]; /* We need them to hold vmin/vtime */
#endif #endif
}; };
...@@ -42,8 +43,7 @@ struct termios2 { ...@@ -42,8 +43,7 @@ struct termios2 {
tcflag_t c_cflag; /* control mode flags */ tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */ tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */ cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */ cc_t c_cc[NCCS+2]; /* control characters */
cc_t _x_cc[2]; /* padding to match ktermios */
speed_t c_ispeed; /* input speed */ speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */ speed_t c_ospeed; /* output speed */
}; };
...@@ -54,8 +54,7 @@ struct ktermios { ...@@ -54,8 +54,7 @@ struct ktermios {
tcflag_t c_cflag; /* control mode flags */ tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */ tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */ cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */ cc_t c_cc[NCCS+2]; /* control characters */
cc_t _x_cc[2]; /* We need them to hold vmin/vtime */
speed_t c_ispeed; /* input speed */ speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */ speed_t c_ospeed; /* output speed */
}; };
......
...@@ -563,9 +563,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp, ...@@ -563,9 +563,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
op->dev.parent = parent; op->dev.parent = parent;
op->dev.bus = &of_platform_bus_type; op->dev.bus = &of_platform_bus_type;
if (!parent) if (!parent)
strcpy(op->dev.bus_id, "root"); dev_set_name(&op->dev, "root");
else else
sprintf(op->dev.bus_id, "%08x", dp->node); dev_set_name(&op->dev, "%08x", dp->node);
if (of_device_register(op)) { if (of_device_register(op)) {
printk("%s: Could not register of device.\n", printk("%s: Could not register of device.\n",
......
/* rtc-sun4c.c: Hypervisor based RTC for SUN4V systems. /* rtc-sun4v.c: Hypervisor based RTC for SUN4V systems.
* *
* Copyright (C) 2008 David S. Miller <davem@davemloft.net> * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
*/ */
...@@ -7,21 +7,11 @@ ...@@ -7,21 +7,11 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/time.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <asm/hypervisor.h> #include <asm/hypervisor.h>
MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
MODULE_DESCRIPTION("SUN4V RTC driver");
MODULE_LICENSE("GPL");
struct sun4v_rtc {
struct rtc_device *rtc;
spinlock_t lock;
};
static unsigned long hypervisor_get_time(void) static unsigned long hypervisor_get_time(void)
{ {
unsigned long ret, time; unsigned long ret, time;
...@@ -45,15 +35,7 @@ static unsigned long hypervisor_get_time(void) ...@@ -45,15 +35,7 @@ static unsigned long hypervisor_get_time(void)
static int sun4v_read_time(struct device *dev, struct rtc_time *tm) static int sun4v_read_time(struct device *dev, struct rtc_time *tm)
{ {
struct sun4v_rtc *p = dev_get_drvdata(dev); rtc_time_to_tm(hypervisor_get_time(), tm);
unsigned long flags, secs;
spin_lock_irqsave(&p->lock, flags);
secs = hypervisor_get_time();
spin_unlock_irqrestore(&p->lock, flags);
rtc_time_to_tm(secs, tm);
return 0; return 0;
} }
...@@ -80,19 +62,14 @@ static int hypervisor_set_time(unsigned long secs) ...@@ -80,19 +62,14 @@ static int hypervisor_set_time(unsigned long secs)
static int sun4v_set_time(struct device *dev, struct rtc_time *tm) static int sun4v_set_time(struct device *dev, struct rtc_time *tm)
{ {
struct sun4v_rtc *p = dev_get_drvdata(dev); unsigned long secs;
unsigned long flags, secs;
int err; int err;
err = rtc_tm_to_time(tm, &secs); err = rtc_tm_to_time(tm, &secs);
if (err) if (err)
return err; return err;
spin_lock_irqsave(&p->lock, flags); return hypervisor_set_time(secs);
err = hypervisor_set_time(secs);
spin_unlock_irqrestore(&p->lock, flags);
return err;
} }
static const struct rtc_class_ops sun4v_rtc_ops = { static const struct rtc_class_ops sun4v_rtc_ops = {
...@@ -100,33 +77,22 @@ static const struct rtc_class_ops sun4v_rtc_ops = { ...@@ -100,33 +77,22 @@ static const struct rtc_class_ops sun4v_rtc_ops = {
.set_time = sun4v_set_time, .set_time = sun4v_set_time,
}; };
static int __devinit sun4v_rtc_probe(struct platform_device *pdev) static int __init sun4v_rtc_probe(struct platform_device *pdev)
{ {
struct sun4v_rtc *p = kzalloc(sizeof(*p), GFP_KERNEL); struct rtc_device *rtc = rtc_device_register("sun4v", &pdev->dev,
if (!p)
return -ENOMEM;
spin_lock_init(&p->lock);
p->rtc = rtc_device_register("sun4v", &pdev->dev,
&sun4v_rtc_ops, THIS_MODULE); &sun4v_rtc_ops, THIS_MODULE);
if (IS_ERR(p->rtc)) { if (IS_ERR(rtc))
int err = PTR_ERR(p->rtc); return PTR_ERR(rtc);
kfree(p);
return err; platform_set_drvdata(pdev, rtc);
}
platform_set_drvdata(pdev, p);
return 0; return 0;
} }
static int __devexit sun4v_rtc_remove(struct platform_device *pdev) static int __exit sun4v_rtc_remove(struct platform_device *pdev)
{ {
struct sun4v_rtc *p = platform_get_drvdata(pdev); struct rtc_device *rtc = platform_get_drvdata(pdev);
rtc_device_unregister(p->rtc);
kfree(p);
rtc_device_unregister(rtc);
return 0; return 0;
} }
...@@ -135,13 +101,12 @@ static struct platform_driver sun4v_rtc_driver = { ...@@ -135,13 +101,12 @@ static struct platform_driver sun4v_rtc_driver = {
.name = "rtc-sun4v", .name = "rtc-sun4v",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = sun4v_rtc_probe, .remove = __exit_p(sun4v_rtc_remove),
.remove = __devexit_p(sun4v_rtc_remove),
}; };
static int __init sun4v_rtc_init(void) static int __init sun4v_rtc_init(void)
{ {
return platform_driver_register(&sun4v_rtc_driver); return platform_driver_probe(&sun4v_rtc_driver, sun4v_rtc_probe);
} }
static void __exit sun4v_rtc_exit(void) static void __exit sun4v_rtc_exit(void)
...@@ -151,3 +116,7 @@ static void __exit sun4v_rtc_exit(void) ...@@ -151,3 +116,7 @@ static void __exit sun4v_rtc_exit(void)
module_init(sun4v_rtc_init); module_init(sun4v_rtc_init);
module_exit(sun4v_rtc_exit); module_exit(sun4v_rtc_exit);
MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
MODULE_DESCRIPTION("SUN4V RTC driver");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment