static int sec_therm_probe(struct platform_device *pdev) { struct sec_therm_platform_data *pdata = fill_therm_pdata(pdev); struct sec_therm_info *info; int ret = 0; dev_info(&pdev->dev, "%s: SEC Thermistor Driver Loading\n", __func__); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; info->dev = &pdev->dev; info->pdata = pdata; platform_set_drvdata(pdev, info); BUG_ON(!sec_class); info->dev = device_create(sec_class, NULL, 0, info, "sec-thermistor"); ret = sysfs_create_group(&info->dev->kobj, &sec_therm_group); if (ret) { dev_err(info->dev, "failed to create sysfs attribute group\n"); kfree(info); } return ret; }
static __devinit int sec_therm_probe(struct platform_device *pdev) { int ret = 0; struct sec_therm_platform_data *pdata = fill_therm_pdata(pdev); struct sec_therm_info *info; dev_info(&pdev->dev, "%s: SEC Thermistor Driver Loading\n", __func__); info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; info->dev = &pdev->dev; info->pdata = pdata; info->vadc_dev = qpnp_get_vadc(info->dev, "therm"); therm_vadc_dev = info->vadc_dev; if (IS_ERR(info->vadc_dev)) { ret = PTR_ERR(info->vadc_dev); pr_err("%s:ret=%d\n",__func__,ret); if (ret != -EPROBE_DEFER) pr_err("vadc property missing\n"); else goto err_therm; } dev_set_drvdata(&pdev->dev, info); ret = sysfs_create_group(&info->dev->kobj, &sec_therm_group); if (ret) { dev_err(info->dev, "failed to create sysfs attribute group\n"); } if (!(pdata->no_polling)) { INIT_DELAYED_WORK_DEFERRABLE(&info->polling_work, sec_therm_polling_work); schedule_delayed_work(&info->polling_work, msecs_to_jiffies(info->pdata->polling_interval)); } return ret; err_therm: kfree(info); return ret; }