本文整理汇总了C++中platform_device_register_simple函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_device_register_simple函数的具体用法?C++ platform_device_register_simple怎么用?C++ platform_device_register_simple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_device_register_simple函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pr_debug
__init struct platform_device *host_pdev_register(struct resource *res, int n_res,
struct fsl_usb2_platform_data *config)
{
struct platform_device *pdev;
int rc;
pr_debug("register host res=0x%p, size=%d\n", res, n_res);
pdev = platform_device_register_simple("fsl-ehci",
usb_mxc_instance_id, res, n_res);
if (IS_ERR(pdev)) {
pr_debug("can't register %s Host, %ld\n",
config->name, PTR_ERR(pdev));
return NULL;
}
pdev->dev.coherent_dma_mask = 0xffffffff;
pdev->dev.dma_mask = &ehci_dmamask;
/*
* platform_device_add_data() makes a copy of
* the platform_data passed in. That makes it
* impossible to share the same config struct for
* all OTG devices (host,gadget,otg). So, just
* set the platorm_data pointer ourselves.
*/
rc = platform_device_add_data(pdev, config,
sizeof(struct fsl_usb2_platform_data));
if (rc) {
platform_device_unregister(pdev);
return NULL;
}
printk(KERN_INFO "usb: %s host (%s) registered\n", config->name,
config->transceiver);
pr_debug("pdev=0x%p dev=0x%p resources=0x%p pdata=0x%p\n",
pdev, &pdev->dev, pdev->resource, pdev->dev.platform_data);
usb_mxc_instance_id++;
return pdev;
}
开发者ID:SanDisk-Open-Source,项目名称:wireless-media-drive,代码行数:42,代码来源:usb_common.c
示例2: acq_init
static int __init acq_init(void)
{
int err;
pr_info("WDT driver for Acquire single board computer initialising\n");
acq_platform_device = platform_device_register_simple(DRV_NAME,
-1, NULL, 0);
if (IS_ERR(acq_platform_device))
return PTR_ERR(acq_platform_device);
err = platform_driver_probe(&acquirewdt_driver, acq_probe);
if (err)
goto unreg_platform_device;
return 0;
unreg_platform_device:
platform_device_unregister(acq_platform_device);
return err;
}
开发者ID:3null,项目名称:linux,代码行数:20,代码来源:acquirewdt.c
示例3: clps711x_add_gpio
static void __init clps711x_add_gpio(void)
{
unsigned i;
struct resource gpio_res[2];
memset(gpio_res, 0, sizeof(gpio_res));
gpio_res[0].flags = IORESOURCE_MEM;
gpio_res[1].flags = IORESOURCE_MEM;
for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
gpio_res[0].end = gpio_res[0].start;
gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
gpio_res[1].end = gpio_res[1].start;
platform_device_register_simple("clps711x-gpio", i,
gpio_res, ARRAY_SIZE(gpio_res));
}
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:20,代码来源:devices.c
示例4: geodewdt_init
static int __init geodewdt_init(void)
{
int ret;
ret = platform_driver_register(&geodewdt_driver);
if (ret)
return ret;
geodewdt_platform_device = platform_device_register_simple(DRV_NAME,
-1, NULL, 0);
if (IS_ERR(geodewdt_platform_device)) {
ret = PTR_ERR(geodewdt_platform_device);
goto err;
}
return 0;
err:
platform_driver_unregister(&geodewdt_driver);
return ret;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:20,代码来源:geodewdt.c
示例5: bma020_acc_init
static int __init bma020_acc_init(void)
{
int result;
result = platform_driver_register( &bma020_accelerometer_driver );
if( result )
{
return result;
}
bma020_accelerometer_device = platform_device_register_simple( "bma020-accelerometer", -1, NULL, 0 );
if( IS_ERR( bma020_accelerometer_device ) )
{
return PTR_ERR( bma020_accelerometer_device );
}
return 0;
}
开发者ID:moikop,项目名称:Astrum-Kernel,代码行数:20,代码来源:bma020_acc.c
示例6: olpc_bat_init
static int __init olpc_bat_init(void)
{
int ret = 0;
uint8_t status;
if (!olpc_platform_info.ecver)
return -ENXIO;
if (olpc_platform_info.ecver < 0x43) {
printk(KERN_NOTICE "OLPC EC version 0x%02x too old for battery driver.\n", olpc_platform_info.ecver);
return -ENXIO;
}
ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &status, 1);
if (ret)
return ret;
/* Ignore the status. It doesn't actually matter */
bat_pdev = platform_device_register_simple("olpc-battery", 0, NULL, 0);
if (IS_ERR(bat_pdev))
return PTR_ERR(bat_pdev);
ret = power_supply_register(&bat_pdev->dev, &olpc_ac);
if (ret)
goto ac_failed;
olpc_bat.name = bat_pdev->name;
ret = power_supply_register(&bat_pdev->dev, &olpc_bat);
if (ret)
goto battery_failed;
goto success;
battery_failed:
power_supply_unregister(&olpc_ac);
ac_failed:
platform_device_unregister(bat_pdev);
success:
return ret;
}
开发者ID:274914765,项目名称:C,代码行数:41,代码来源:olpc_battery.c
示例7: ct82c710_init
static int __init ct82c710_init(void)
{
if (ct82c710_probe())
return -ENODEV;
ct82c710_device = platform_device_register_simple("ct82c710", -1, &ct82c710_iores, 1);
if (IS_ERR(ct82c710_device))
return PTR_ERR(ct82c710_device);
if (!(ct82c710_port = ct82c710_allocate_port())) {
platform_device_unregister(ct82c710_device);
return -ENOMEM;
}
serio_register_port(ct82c710_port);
printk(KERN_INFO "serio: C&T 82c710 mouse port at %#lx irq %d\n",
CT82C710_DATA, CT82C710_IRQ);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:21,代码来源:ct82c710.c
示例8: mini2440_machine_init
static void __init mini2440_machine_init(void)
{
s3c24xx_fb_set_platdata(&s3c24xx_fb_info);
s3c_i2c0_set_platdata(NULL);
s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
printk("S3C2410_GPA=%d\n",S3C2410_GPA(0));
printk("S3C2410_GPB=%d\n",S3C2410_GPB(0));
printk("S3C2410_GPC=%d\n",S3C2410_GPC(0));
printk("S3C2410_GPD=%d\n",S3C2410_GPD(0));
printk("S3C2410_GPE=%d\n",S3C2410_GPE(0));
printk("S3C2410_GPF=%d\n",S3C2410_GPF(0));
printk("S3C2410_GPG=%d\n",S3C2410_GPG(0));
printk("S3C2410_GPH=%d\n",S3C2410_GPH(0));
s3c_device_nand.dev.platform_data = &friendly_arm_nand_info;
s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); //GPIO resource MAP
s3c_pm_init();
}
开发者ID:IoveSunny,项目名称:DreamBox,代码行数:21,代码来源:mach-mini2440.c
示例9: simone_probe
static int __devinit simone_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_simone;
int ret;
simone_snd_ac97_device = platform_device_register_simple("ac97-codec",
-1, NULL, 0);
if (IS_ERR(simone_snd_ac97_device))
return PTR_ERR(simone_snd_ac97_device);
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
platform_device_unregister(simone_snd_ac97_device);
}
return ret;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:21,代码来源:simone.c
示例10: imx51_soc_init
void __init imx51_soc_init(void)
{
/* i.mx51 has the i.mx31 type gpio */
mxc_register_gpio("imx31-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH);
mxc_register_gpio("imx31-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH);
mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_INT_GPIO3_LOW, MX51_INT_GPIO3_HIGH);
mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_INT_GPIO4_LOW, MX51_INT_GPIO4_HIGH);
pinctrl_provide_dummies();
/* i.mx51 has the i.mx35 type sdma */
imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
/* Setup AIPS registers */
imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR));
imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR));
/* i.mx51 has the i.mx31 type audmux */
platform_device_register_simple("imx31-audmux", 0, imx51_audmux_res,
ARRAY_SIZE(imx51_audmux_res));
}
开发者ID:benedictsibiya,项目名称:linux,代码行数:21,代码来源:mm-imx5.c
示例11: ape6evm_add_standard_devices
static void __init ape6evm_add_standard_devices(void)
{
struct clk *parent;
struct clk *mp;
r8a73a4_clock_init();
/* MP clock parent = extal2 */
parent = clk_get(NULL, "extal2");
mp = clk_get(NULL, "mp");
BUG_ON(IS_ERR(parent) || IS_ERR(mp));
clk_set_parent(mp, parent);
clk_put(parent);
clk_put(mp);
r8a73a4_add_dt_devices();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
}
开发者ID:03199618,项目名称:linux,代码行数:21,代码来源:board-ape6evm-reference.c
示例12: mmc328x_init
static int __init mmc328x_init(void)
{
int result;
result = platform_driver_register( &mmc328x_magnetic_driver );
pr_info("mmc328x driver: init : %d\n",result);
atomic_set(&suspend_flag, 0);
pr_info("mmc328x suspend mode : %d\n",suspend_flag.counter);
if( result )
{
return result;
}
mmc328x_magnetic_device = platform_device_register_simple( "mmc328x-magnetic", -1, NULL, 0 );
if( IS_ERR( mmc328x_magnetic_device ) )
{
return PTR_ERR( mmc328x_magnetic_device );
}
return 0;
}
开发者ID:CenterTurkHD,项目名称:android_kernel_samsung_hugo,代码行数:21,代码来源:mmc328x.c
示例13: cvm_oct_init_module
static int __init cvm_oct_init_module(void)
{
int err;
struct platform_device *dev;
err = platform_driver_register(&cvm_oct_driver);
if (err) {
pr_err("Failed to register cavium-ethernet driver\n");
return err;
}
dev = platform_device_register_simple(cvm_oct_driver.driver.name,
-1, NULL, 0);
if (IS_ERR(dev)) {
platform_driver_unregister(&cvm_oct_driver);
return PTR_ERR(dev);
}
cvm_oct_plat_device = dev;
return 0;
}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:21,代码来源:ethernet.c
示例14: warpfpga_init_module
static int __init warpfpga_init_module(void)
{
int ret = 0;
// Create PDX global veriable - this is for legacy uses
if ((pdx = kzalloc(sizeof(DEVICE_EXTENSION), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "%s:%s() error allocating memory\n",
__FILE__, __FUNCTION__);
return -ENOMEM;
}
// You need a device for DMA or nothing works with 2.6.31
pdx->dev = platform_device_register_simple("warp-dev", 0, NULL, 0);
pdx->dev->dev.coherent_dma_mask = ~0ULL;
// Create spin-lock
spin_lock_init(&fpgalock);
// Register device
printk(KERN_INFO "Registering WARP FPGA driver\n");
#ifdef WARP_V2
ret = platform_driver_register(&warp_fpga_platform_driver);
#else
ret = pci_register_driver(&warp_fpga_pci_driver);
#endif
printk(KERN_INFO "WARP FPGA driver registration successful\n");
// Check probing was done
if (ret != 0) {
printk(KERN_ERR "%s:%s() error registering driver\n", __FILE__, __FUNCTION__);
goto error_cleanup;
}
return 0;
error_cleanup:
kfree(pdx);
platform_device_unregister(pdx->dev);
return -ENOENT;
}
开发者ID:dvangilst,项目名称:dahdi-linux,代码行数:40,代码来源:warp-fpga.c
示例15: alsa_card_dummy_init
static int __init alsa_card_dummy_init(void)
{
int i, cards, err;
err = platform_driver_register(&snd_dummy_driver);
if (err < 0)
return err;
err = alloc_fake_buffer();
if (err < 0) {
platform_driver_unregister(&snd_dummy_driver);
return err;
}
cards = 0;
for (i = 0; i < SNDRV_CARDS; i++) {
struct platform_device *device;
if (! enable[i])
continue;
device = platform_device_register_simple(SND_DUMMY_DRIVER,
i, NULL, 0);
if (IS_ERR(device))
continue;
if (!platform_get_drvdata(device)) {
platform_device_unregister(device);
continue;
}
devices[i] = device;
cards++;
}
if (!cards) {
#ifdef MODULE
printk(KERN_ERR "Dummy soundcard not found or device busy\n");
#endif
snd_dummy_unregister_all();
return -ENODEV;
}
return 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:39,代码来源:dummy.c
示例16: toshiba_rbtx4927_rtc_init
static void __init toshiba_rbtx4927_rtc_init(void)
{
struct resource res = {
.start = RBTX4927_BRAMRTC_BASE - IO_BASE,
.end = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1,
.flags = IORESOURCE_MEM,
};
platform_device_register_simple("rtc-ds1742", -1, &res, 1);
}
static void __init rbtx4927_ne_init(void)
{
struct resource res[] = {
{
.start = RBTX4927_RTL_8019_BASE,
.end = RBTX4927_RTL_8019_BASE + 0x20 - 1,
.flags = IORESOURCE_IO,
}, {
.start = RBTX4927_RTL_8019_IRQ,
.flags = IORESOURCE_IRQ,
}
};
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:22,代码来源:setup.c
示例17: imx27_soc_init
void __init imx27_soc_init(void)
{
mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
mxc_device_init();
/* i.mx27 has the i.mx21 type gpio */
mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
mxc_register_gpio("imx21-gpio", 2, MX27_GPIO3_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
mxc_register_gpio("imx21-gpio", 3, MX27_GPIO4_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
pinctrl_provide_dummies();
imx_add_imx_dma("imx27-dma", MX27_DMA_BASE_ADDR,
MX27_INT_DMACH0, 0); /* No ERR irq */
/* imx27 has the imx21 type audmux */
platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
ARRAY_SIZE(imx27_audmux_res));
imx27_pm_init();
}
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:22,代码来源:mm-imx27.c
示例18: alsa_card_mpu401_init
static int __init alsa_card_mpu401_init(void)
{
int i, err;
if ((err = platform_driver_register(&snd_mpu401_driver)) < 0)
return err;
for (i = 0; i < SNDRV_CARDS; i++) {
struct platform_device *device;
if (! enable[i])
continue;
#ifdef CONFIG_PNP
if (pnp[i])
continue;
#endif
device = platform_device_register_simple(SND_MPU401_DRIVER,
i, NULL, 0);
if (IS_ERR(device))
continue;
if (!platform_get_drvdata(device)) {
platform_device_unregister(device);
continue;
}
platform_devices[i] = device;
snd_mpu401_devices++;
}
err = pnp_register_driver(&snd_mpu401_pnp_driver);
if (!err)
pnp_registered = 1;
if (!snd_mpu401_devices) {
#ifdef MODULE
printk(KERN_ERR "MPU-401 device not found or device busy\n");
#endif
snd_mpu401_unregister_all();
return -ENODEV;
}
return 0;
}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:39,代码来源:mpu401.c
示例19: android_bat_init
static int __init android_bat_init(void)
{
int ret = 0;
bat_pdev = platform_device_register_simple("battery", 0, NULL, 0);
ret = power_supply_register(&bat_pdev->dev, &android_ac);
if (ret)
goto ac_failed;
android_bat.name = bat_pdev->name;
ret = power_supply_register(&bat_pdev->dev, &android_bat);
if (ret)
goto battery_failed;
goto success;
power_supply_unregister(&android_bat);
battery_failed:
power_supply_unregister(&android_ac);
ac_failed:
platform_device_unregister(bat_pdev);
success:
return ret;
}
开发者ID:andycodes,项目名称:helloworld,代码行数:22,代码来源:battery_driver.c
示例20: add_rtc
static int __init add_rtc(void)
{
struct device_node *np;
struct platform_device *pd;
struct resource res[2];
int ret;
memset(&res, 0, sizeof(res));
np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
if (!np)
return -ENODEV;
ret = of_address_to_resource(np, 0, &res[0]);
of_node_put(np);
if (ret)
return ret;
/*
* RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the
* address provided by the device node matches.
*/
if (res[0].start != RTC_PORT(0))
return -EINVAL;
/* Use a fixed interrupt value of 8 since on PPC if we are using this
* its off an i8259 which we ensure has interrupt numbers 0..15. */
res[1].start = 8;
res[1].end = 8;
res[1].flags = IORESOURCE_IRQ;
pd = platform_device_register_simple("rtc_cmos", -1,
&res[0], 2);
if (IS_ERR(pd))
return PTR_ERR(pd);
return 0;
}
开发者ID:human3000,项目名称:linux-2.6,代码行数:39,代码来源:rtc_cmos_setup.c
注:本文中的platform_device_register_simple函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论