本文整理汇总了C++中platform_device_del函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_device_del函数的具体用法?C++ platform_device_del怎么用?C++ platform_device_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_device_del函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mdm_peripheral_disconnect
void mdm_peripheral_disconnect(struct mdm_modem_drv *mdm_drv)
{
struct mdm_platform_data *pdata;
pr_info("%s\n", __func__);
if (!mdm_drv || !mdm_drv->pdata)
return;
pdata = mdm_drv->pdata;
mutex_lock(&hsic_status_lock);
if (!hsic_peripheral_status)
goto out;
/* exynos usb phy contgrol seq
* ehci on -> ohci on -> ohci off -> ehci on
*/
if (pdata->peripheral_platform_device_ohci)
platform_device_del(pdata->peripheral_platform_device_ohci);
if (pdata->peripheral_platform_device_ehci)
platform_device_del(pdata->peripheral_platform_device_ehci);
hsic_peripheral_status = 0;
out:
mutex_unlock(&hsic_status_lock);
}
示例2: ev3dev_sound_exit
/*
* called to clean-up before module exit.
*/
static void ev3dev_sound_exit (void)
{
sound_module_exit ();
platform_device_del (sound);
platform_device_put (sound);
}
示例3: test_init
static int __init test_init(void)
{
int i, err;
if ((err = platform_driver_register(&test_driver)))
return err;
err = -ENOMEM;
for (i = 0; i < MAX_RTC_TEST; i++) {
pdev[i] = platform_device_alloc("rtc-test", i);
if (!pdev[i])
goto exit_free_mem;
}
for (i = 0; i < MAX_RTC_TEST; i++) {
err = platform_device_add(pdev[i]);
if (err)
goto exit_device_del;
}
return 0;
exit_device_del:
for (; i > 0; i--)
platform_device_del(pdev[i - 1]);
exit_free_mem:
for (i = 0; i < MAX_RTC_TEST; i++)
platform_device_put(pdev[i]);
platform_driver_unregister(&test_driver);
return err;
}
示例4: power_down_mdm
static void power_down_mdm(struct mdm_modem_drv *mdm_drv)
{
int i;
for (i = MDM_MODEM_TIMEOUT; i > 0; i -= MDM_MODEM_DELTA) {
pet_watchdog();
msleep(MDM_MODEM_DELTA);
if (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 0)
break;
}
if (i <= 0) {
pr_err("%s: MDM2AP_STATUS never went low.\n",
__func__);
gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0);
for (i = MDM_HOLD_TIME; i > 0; i -= MDM_MODEM_DELTA) {
pet_watchdog();
msleep(MDM_MODEM_DELTA);
}
}
/* Also remove the hsic device on 9k power down. */
MDM_DBG("%s: Removing hsic device\n", __func__);
if (ifline_status == IFLINE_UP) {
platform_device_del(&msm_device_hsic_host);
ifline_status = IFLINE_DOWN;
}
}
示例5: power_on_mdm
static void power_on_mdm(struct mdm_modem_drv *mdm_drv)
{
/* Remove hsic driver before powering on the modem. */
if (ifline_status == IFLINE_UP) {
MDM_DBG("%s: Removing hsic device\n", __func__);
platform_device_del(&msm_device_hsic_host);
ifline_status = IFLINE_DOWN;
}
/* Pull both ERR_FATAL and RESET low */
MDM_DBG("Pulling PWR and RESET gpio's low\n");
gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0);
gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 0);
/* Wait for them to settle. */
usleep(1000);
/* Deassert RESET first and wait for ir to settle. */
MDM_DBG("%s: Pulling RESET gpio high\n", __func__);
gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1);
usleep(1000);
/* Pull PWR gpio high and wait for it to settle. */
MDM_DBG("%s: Powering on mdm modem\n", __func__);
gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1);
usleep(1000);
/* Add back hsic device after modem power up */
MDM_DBG("%s: Adding hsic device\n", __func__);
platform_device_add(&msm_device_hsic_host);
ifline_status = IFLINE_UP;
msleep(200);
}
示例6: osk_soc_init
static int __init osk_soc_init(void)
{
int err;
u32 curRate;
struct device *dev;
if (!(machine_is_omap_osk()))
return -ENODEV;
osk_snd_device = platform_device_alloc("soc-audio", -1);
if (!osk_snd_device)
return -ENOMEM;
platform_set_drvdata(osk_snd_device, &osk_snd_devdata);
osk_snd_devdata.dev = &osk_snd_device->dev;
*(unsigned int *)osk_dai.cpu_dai->private_data = 0; /* McBSP1 */
err = platform_device_add(osk_snd_device);
if (err)
goto err1;
dev = &osk_snd_device->dev;
tlv320aic23_mclk = clk_get(dev, "mclk");
if (IS_ERR(tlv320aic23_mclk)) {
printk(KERN_ERR "Could not get mclk clock\n");
return -ENODEV;
}
if (clk_get_usecount(tlv320aic23_mclk) > 0) {
/* MCLK is already in use */
printk(KERN_WARNING
"MCLK in use at %d Hz. We change it to %d Hz\n",
(uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
}
/*
* Configure 12 MHz output on MCLK.
*/
curRate = (uint) clk_get_rate(tlv320aic23_mclk);
if (curRate != CODEC_CLOCK) {
if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
err = -ECANCELED;
goto err1;
}
}
printk(KERN_INFO "MCLK = %d [%d], usecount = %d\n",
(uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK,
clk_get_usecount(tlv320aic23_mclk));
return 0;
err1:
clk_put(tlv320aic23_mclk);
platform_device_del(osk_snd_device);
platform_device_put(osk_snd_device);
return err;
}
示例7: aml_pmu_probe
static int __devinit aml_pmu_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct platform_device *pdev;
int ret;
/*
* allocate and regist AML1212 devices, then kernel will probe driver for AML1212
*/
#ifdef CONFIG_AML1212
pdev = platform_device_alloc(AML1212_SUPPLY_NAME, AML1212_SUPPLY_ID);
if (pdev == NULL) {
printk(">> %s, allocate platform device failed\n", __func__);
return -ENOMEM;
}
pdev->dev.parent = &client->dev;
pdev->dev.platform_data = client->dev.platform_data;
ret = platform_device_add(pdev);
if (ret) {
printk(">> %s, add platform device failed\n", __func__);
platform_device_del(pdev);
return -EINVAL;
}
i2c_set_clientdata(client, pdev);
#endif
return 0;
}
示例8: test_init
static int test_init(void)
{
int ret;
ret = platform_driver_register(&test_driver);
if (ret)
return ret;
test_pdev = platform_device_alloc("rpm_test", 0);
if (!test_pdev) {
ret = -EINVAL;
goto err_alloc_null;
}
if (IS_ERR(test_pdev)) {
ret = PTR_ERR(test_pdev);
goto err_alloc_null;
}
ret = platform_device_add(test_pdev);
if (ret) {
platform_device_put(test_pdev);
goto err_add;
}
return 0;
err_add:
platform_device_del(test_pdev);
err_alloc_null:
platform_driver_unregister(&test_driver);
return ret;
}
示例9: asus_platform_init
static int asus_platform_init(struct asus_laptop *asus)
{
int result;
asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, -1);
if (!asus->platform_device)
return -ENOMEM;
platform_set_drvdata(asus->platform_device, asus);
result = platform_device_add(asus->platform_device);
if (result)
goto fail_platform_device;
result = sysfs_create_group(&asus->platform_device->dev.kobj,
&asus_attr_group);
if (result)
goto fail_sysfs;
return 0;
fail_sysfs:
platform_device_del(asus->platform_device);
fail_platform_device:
platform_device_put(asus->platform_device);
return result;
}
示例10: asus_platform_init
static int asus_platform_init(struct asus_laptop *asus)
{
int err;
asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, -1);
if (!asus->platform_device)
return -ENOMEM;
platform_set_drvdata(asus->platform_device, asus);
err = platform_device_add(asus->platform_device);
if (err)
goto fail_platform_device;
err = asus_sysfs_init(asus);
if (err)
goto fail_sysfs;
return 0;
fail_sysfs:
asus_sysfs_exit(asus);
platform_device_del(asus->platform_device);
fail_platform_device:
platform_device_put(asus->platform_device);
return err;
}
示例11: wm8350_register_regulator
int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
struct regulator_init_data *initdata)
{
struct platform_device *pdev;
int ret;
if (wm8350->pmic.pdev[reg])
return -EBUSY;
pdev = platform_device_alloc("wm8350-regulator", reg);
if (!pdev)
return -ENOMEM;
wm8350->pmic.pdev[reg] = pdev;
initdata->driver_data = wm8350;
pdev->dev.platform_data = initdata;
pdev->dev.parent = wm8350->dev;
platform_set_drvdata(pdev, wm8350);
ret = platform_device_add(pdev);
if (ret != 0) {
dev_err(wm8350->dev, "Failed to register regulator %d: %d\n",
reg, ret);
platform_device_del(pdev);
wm8350->pmic.pdev[reg] = NULL;
}
return ret;
}
示例12: d2083_register_regulator
static int d2083_register_regulator(struct d2083 *d2083, int reg,
struct regulator_init_data *initdata)
{
struct platform_device *pdev;
int ret;
if (reg < D2083_BUCK_1 || reg >= D2083_NUMBER_OF_REGULATORS)
return -EINVAL;
if (d2083->pmic.pdev[reg])
return -EBUSY;
pdev = platform_device_alloc(DRIVER_NAME, reg);
if (!pdev)
return -ENOMEM;
d2083->pmic.pdev[reg] = pdev;
initdata->driver_data = d2083;
pdev->dev.platform_data = initdata;
pdev->dev.parent = d2083->dev;
platform_set_drvdata(pdev, d2083);
ret = platform_device_add(pdev);
if (ret != 0) {
dev_err(d2083->dev, "Failed to register regulator %d: %d\n", reg, ret);
platform_device_del(pdev);
d2083->pmic.pdev[reg] = NULL;
}
return ret;
}
示例13: smdk_init
static int __init smdk_init(void)
{
int ret;
smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
if (!smdk_snd_wm9713_device)
return -ENOMEM;
ret = platform_device_add(smdk_snd_wm9713_device);
if (ret)
goto err1;
smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
if (!smdk_snd_ac97_device) {
ret = -ENOMEM;
goto err2;
}
platform_set_drvdata(smdk_snd_ac97_device, &smdk);
ret = platform_device_add(smdk_snd_ac97_device);
if (ret)
goto err3;
return 0;
err3:
platform_device_put(smdk_snd_ac97_device);
err2:
platform_device_del(smdk_snd_wm9713_device);
err1:
platform_device_put(smdk_snd_wm9713_device);
return ret;
}
示例14: tc1100_init
static int __init tc1100_init(void)
{
int error;
if (!wmi_has_guid(GUID))
return -ENODEV;
tc1100_device = platform_device_alloc("tc1100-wmi", -1);
if (!tc1100_device)
return -ENOMEM;
error = platform_device_add(tc1100_device);
if (error)
goto err_device_put;
error = platform_driver_probe(&tc1100_driver, tc1100_probe);
if (error)
goto err_device_del;
pr_info("HP Compaq TC1100 Tablet WMI Extras loaded\n");
return 0;
err_device_del:
platform_device_del(tc1100_device);
err_device_put:
platform_device_put(tc1100_device);
return error;
}
示例15: max17135_register_regulator
int max17135_register_regulator(struct max17135 *max17135, int reg,
struct regulator_init_data *initdata)
{
struct platform_device *pdev;
int ret;
struct i2c_client *client = max17135->i2c_client;
/* If we can't find PMIC via I2C, we should not register regulators */
if (i2c_smbus_read_byte_data(client,
REG_MAX17135_PRODUCT_REV) != 0) {
dev_err(max17135->dev,
"Max17135 PMIC not found!\n");
return -ENXIO;
}
if (max17135->pdev[reg])
return -EBUSY;
pdev = platform_device_alloc("max17135-reg", reg);
if (!pdev)
return -ENOMEM;
max17135->pdev[reg] = pdev;
initdata->driver_data = max17135;
pdev->dev.platform_data = initdata;
pdev->dev.parent = max17135->dev;
platform_set_drvdata(pdev, max17135);
ret = platform_device_add(pdev);
if (ret != 0) {
dev_err(max17135->dev,
"Failed to register regulator %d: %d\n",
reg, ret);
platform_device_del(pdev);
max17135->pdev[reg] = NULL;
}
if (!max17135->init_done) {
max17135->pass_num = max17135_pass_num;
max17135->vcom_uV = max17135_vcom;
/*
* Set up PMIC timing values.
* Should only be done one time! Timing values may only be
* changed a limited number of times according to spec.
*/
max17135_setup_timings(max17135);
max17135->pwrgood_polarity =
gpio_get_value(max17135->gpio_pmic_pwrgood);
max17135->init_done = true;
}
return ret;
}