aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/net_kern.c47
-rw-r--r--arch/um/drivers/ubd_kern.c9
2 files changed, 21 insertions, 35 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index fe865d9a3721..84c73a300acb 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -243,34 +243,18 @@ static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
243 return err; 243 return err;
244} 244}
245 245
246static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 246static void uml_net_get_drvinfo(struct net_device *dev,
247{ 247 struct ethtool_drvinfo *info)
248 static const struct ethtool_drvinfo info = { 248{
249 .cmd = ETHTOOL_GDRVINFO, 249 strcpy(info->driver, DRIVER_NAME);
250 .driver = DRIVER_NAME, 250 strcpy(info->version, "42");
251 .version = "42",
252 };
253 void *useraddr;
254 u32 ethcmd;
255
256 switch (cmd) {
257 case SIOCETHTOOL:
258 useraddr = ifr->ifr_data;
259 if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
260 return -EFAULT;
261 switch (ethcmd) {
262 case ETHTOOL_GDRVINFO:
263 if (copy_to_user(useraddr, &info, sizeof(info)))
264 return -EFAULT;
265 return 0;
266 default:
267 return -EOPNOTSUPP;
268 }
269 default:
270 return -EINVAL;
271 }
272} 251}
273 252
253static struct ethtool_ops uml_net_ethtool_ops = {
254 .get_drvinfo = uml_net_get_drvinfo,
255 .get_link = ethtool_op_get_link,
256};
257
274void uml_net_user_timer_expire(unsigned long _conn) 258void uml_net_user_timer_expire(unsigned long _conn)
275{ 259{
276#ifdef undef 260#ifdef undef
@@ -284,9 +268,10 @@ void uml_net_user_timer_expire(unsigned long _conn)
284static DEFINE_SPINLOCK(devices_lock); 268static DEFINE_SPINLOCK(devices_lock);
285static struct list_head devices = LIST_HEAD_INIT(devices); 269static struct list_head devices = LIST_HEAD_INIT(devices);
286 270
287static struct device_driver uml_net_driver = { 271static struct platform_driver uml_net_driver = {
288 .name = DRIVER_NAME, 272 .driver = {
289 .bus = &platform_bus_type, 273 .name = DRIVER_NAME,
274 },
290}; 275};
291static int driver_registered; 276static int driver_registered;
292 277
@@ -333,7 +318,7 @@ static int eth_configure(int n, void *init, char *mac,
333 318
334 /* sysfs register */ 319 /* sysfs register */
335 if (!driver_registered) { 320 if (!driver_registered) {
336 driver_register(&uml_net_driver); 321 platform_driver_register(&uml_net_driver);
337 driver_registered = 1; 322 driver_registered = 1;
338 } 323 }
339 device->pdev.id = n; 324 device->pdev.id = n;
@@ -359,7 +344,7 @@ static int eth_configure(int n, void *init, char *mac,
359 dev->tx_timeout = uml_net_tx_timeout; 344 dev->tx_timeout = uml_net_tx_timeout;
360 dev->set_mac_address = uml_net_set_mac; 345 dev->set_mac_address = uml_net_set_mac;
361 dev->change_mtu = uml_net_change_mtu; 346 dev->change_mtu = uml_net_change_mtu;
362 dev->do_ioctl = uml_net_ioctl; 347 dev->ethtool_ops = &uml_net_ethtool_ops;
363 dev->watchdog_timeo = (HZ >> 1); 348 dev->watchdog_timeo = (HZ >> 1);
364 dev->irq = UM_ETH_IRQ; 349 dev->irq = UM_ETH_IRQ;
365 350
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index b2c86257b0f8..93898917cbe5 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -823,9 +823,10 @@ static int ubd_mc_init(void)
823 823
824__initcall(ubd_mc_init); 824__initcall(ubd_mc_init);
825 825
826static struct device_driver ubd_driver = { 826static struct platform_driver ubd_driver = {
827 .name = DRIVER_NAME, 827 .driver = {
828 .bus = &platform_bus_type, 828 .name = DRIVER_NAME,
829 },
829}; 830};
830 831
831int ubd_init(void) 832int ubd_init(void)
@@ -850,7 +851,7 @@ int ubd_init(void)
850 if (register_blkdev(fake_major, "ubd")) 851 if (register_blkdev(fake_major, "ubd"))
851 return -1; 852 return -1;
852 } 853 }
853 driver_register(&ubd_driver); 854 platform_driver_register(&ubd_driver);
854 for (i = 0; i < MAX_DEV; i++) 855 for (i = 0; i < MAX_DEV; i++)
855 ubd_add(i); 856 ubd_add(i);
856 return 0; 857 return 0;