コード例 #1
0
ファイル: parse-xml.c プロジェクト: syuxue/subsurface
static void dc_settings_end(void)
{
	struct device_info *info;

	info = create_device_info(cur_settings.dc.model, cur_settings.dc.deviceid);
	if (info) {
		if (!info->serial_nr && cur_settings.dc.serial_nr)
			info->serial_nr = strdup(cur_settings.dc.serial_nr);
		if (!info->firmware && cur_settings.dc.firmware)
			info->firmware = strdup(cur_settings.dc.firmware);
		if (!info->nickname && cur_settings.dc.nickname)
			info->nickname = strdup(cur_settings.dc.nickname);
	}
	reset_dc_settings();
}
コード例 #2
0
int32_t msm_sensor_i2c_probe(struct i2c_client *client,
	const struct i2c_device_id *id)
{
	int rc = 0;
	struct msm_sensor_ctrl_t *s_ctrl;
	CDBG("%s %s_i2c_probe called\n", __func__, client->name);
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		pr_err("%s %s i2c_check_functionality failed\n",
			__func__, client->name);
		rc = -EFAULT;
		return rc;
	}

	s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data);
	if (s_ctrl->sensor_i2c_client != NULL) {
		s_ctrl->sensor_i2c_client->client = client;
		if (s_ctrl->sensor_i2c_addr != 0)
			s_ctrl->sensor_i2c_client->client->addr =
				s_ctrl->sensor_i2c_addr;
	} else {
		pr_err("%s %s sensor_i2c_client NULL\n",
			__func__, client->name);
		rc = -EFAULT;
		return rc;
	}

	s_ctrl->sensordata = client->dev.platform_data;
	if (s_ctrl->sensordata == NULL) {
		pr_err("%s %s NULL sensor data\n", __func__, client->name);
		return -EFAULT;
	}

	rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
	if (rc < 0) {
		pr_err("%s %s power up failed\n", __func__, client->name);
		return rc;
	}

	if (s_ctrl->func_tbl->sensor_match_id)
		rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl);
	else
		rc = msm_sensor_match_id(s_ctrl);
	if (rc < 0)
		goto probe_fail;

#ifdef CONFIG_MACH_ACER_A9
	if (s_ctrl->sensor_info) {
		if (create_device_info(s_ctrl->sensor_info))
			pr_err("%s: create_device_info failed\n", __func__);

	} else {
		pr_err("%s: %s doesn't contain device info\n",
			__func__, s_ctrl->sensor_i2c_driver->driver.name);
	}
#endif
	snprintf(s_ctrl->sensor_v4l2_subdev.name,
		sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name);
	v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client,
		s_ctrl->sensor_v4l2_subdev_ops);

	msm_sensor_register(&s_ctrl->sensor_v4l2_subdev);
	goto power_down;
probe_fail:
	pr_err("%s %s_i2c_probe failed\n", __func__, client->name);
power_down:
	if (rc > 0)
		rc = 0;
	s_ctrl->func_tbl->sensor_power_down(s_ctrl);

	pr_err("%s %s success\n", __func__,client->name);
	return rc;
}