Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  Cobalt buttons platform device.
0004  *
0005  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
0006  */
0007 
0008 #include <linux/platform_device.h>
0009 #include <linux/errno.h>
0010 #include <linux/init.h>
0011 
0012 static struct resource cobalt_buttons_resource __initdata = {
0013     .start  = 0x1d000000,
0014     .end    = 0x1d000003,
0015     .flags  = IORESOURCE_MEM,
0016 };
0017 
0018 static __init int cobalt_add_buttons(void)
0019 {
0020     struct platform_device *pd;
0021     int error;
0022 
0023     pd = platform_device_alloc("Cobalt buttons", -1);
0024     if (!pd)
0025         return -ENOMEM;
0026 
0027     error = platform_device_add_resources(pd, &cobalt_buttons_resource, 1);
0028     if (error)
0029         goto err_free_device;
0030 
0031     error = platform_device_add(pd);
0032     if (error)
0033         goto err_free_device;
0034 
0035     return 0;
0036 
0037  err_free_device:
0038     platform_device_put(pd);
0039     return error;
0040 }
0041 device_initcall(cobalt_add_buttons);