Back to home page

OSCL-LXR

 
 

    


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