本文整理汇总了C++中platform_device_register_simple函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_device_register_simple函数的具体用法?C++ platform_device_register_simple怎么用?C++ platform_device_register_simple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_device_register_simple函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}