diff --git a/core/lego_bus.c b/core/lego_bus.c index cce0456..f17d38f 100644 --- a/core/lego_bus.c +++ b/core/lego_bus.c @@ -173,7 +173,7 @@ static struct attribute *lego_bus_dev_attrs[] = { }; ATTRIBUTE_GROUPS(lego_bus_dev); -static int lego_bus_match(struct device *dev, struct device_driver *drv) +static int lego_bus_match(struct device *dev, const struct device_driver *drv) { struct lego_device *ldev = to_lego_device(dev); struct lego_device_driver *ldrv = to_lego_device_driver(drv); diff --git a/ev3/ev3_ports_core.c b/ev3/ev3_ports_core.c index 686c46b..ec3c21a 100644 --- a/ev3/ev3_ports_core.c +++ b/ev3/ev3_ports_core.c @@ -92,11 +92,10 @@ static int ev3_ports_probe(struct platform_device *pdev) return 0; } -static int ev3_ports_remove(struct platform_device *pdev) +static void ev3_ports_remove(struct platform_device *pdev) { of_platform_depopulate(&pdev->dev); - return 0; } static const struct of_device_id ev3_ports_dt_ids[] = { diff --git a/ev3/ev3_ports_in.c b/ev3/ev3_ports_in.c index 6ce733c..217f623 100644 --- a/ev3/ev3_ports_in.c +++ b/ev3/ev3_ports_in.c @@ -1230,8 +1230,7 @@ static int ev3_input_port_probe(struct platform_device *pdev) INIT_WORK(&data->change_uevent_work, ev3_input_port_change_uevent_work); INIT_WORK(&data->work, NULL); - hrtimer_init(&data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - data->timer.function = ev3_input_port_timer_callback; + hrtimer_setup(&data->timer, ev3_input_port_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL); data->con_state = CON_STATE_INIT; hrtimer_start(&data->timer, ktime_set(0, INPUT_PORT_POLL_NS), @@ -1254,7 +1253,7 @@ static int ev3_input_port_probe(struct platform_device *pdev) return err; } -static int ev3_input_port_remove(struct platform_device *pdev) +static void ev3_input_port_remove(struct platform_device *pdev) { struct ev3_input_port_data *data = dev_get_drvdata(&pdev->dev); @@ -1273,7 +1272,6 @@ static int ev3_input_port_remove(struct platform_device *pdev) iio_channel_release_all_cb(data->iio_cb); ev3_input_port_float(data); - return 0; } static const struct of_device_id ev3_input_port_dt_ids[] = { diff --git a/ev3/ev3_ports_out.c b/ev3/ev3_ports_out.c index 9d16239..82294de 100644 --- a/ev3/ev3_ports_out.c +++ b/ev3/ev3_ports_out.c @@ -339,7 +339,7 @@ static int ev3_output_port_set_duty_cycle(void *context, unsigned duty) if (ret) return ret; - return pwm_apply_state(data->pwm, &state); + return pwm_apply_atomic(data->pwm, &state); } static struct dc_motor_ops ev3_output_port_motor_ops = { @@ -807,7 +807,7 @@ static int ev3_output_port_probe(struct platform_device *pdev) goto err_stop_iio_cb; } /* This lets us set the pwm duty cycle in an atomic context */ - pm_runtime_irq_safe(data->pwm->chip->dev); + pm_runtime_irq_safe(&data->pwm->chip->dev); data->out_port.name = ev3_output_port_type.name; snprintf(data->out_port.address, LEGO_NAME_SIZE, "%s", @@ -834,10 +834,9 @@ static int ev3_output_port_probe(struct platform_device *pdev) data->con_state = CON_STATE_INIT; - hrtimer_init(&data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - data->timer.function = ev3_output_port_timer_callback; + hrtimer_setup(&data->timer, ev3_output_port_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_start(&data->timer, ktime_set(0, OUTPUT_PORT_POLL_NS), - HRTIMER_MODE_REL); + HRTIMER_MODE_REL); if (!IS_ERR_OR_NULL(ev3_ports_debug)) ev3_output_port_debug_init(data); @@ -854,7 +853,7 @@ static int ev3_output_port_probe(struct platform_device *pdev) return err; } -static int ev3_output_port_remove(struct platform_device *pdev) +static void ev3_output_port_remove(struct platform_device *pdev) { struct ev3_output_port_data *data = dev_get_drvdata(&pdev->dev); @@ -873,7 +872,6 @@ static int ev3_output_port_remove(struct platform_device *pdev) iio_channel_stop_all_cb(data->iio_cb); iio_channel_release_all_cb(data->iio_cb); - return 0; } static const struct of_device_id ev3_output_port_dt_ids[] = { diff --git a/ev3/legoev3_i2c.c b/ev3/legoev3_i2c.c index 3ebd007..7b4678c 100644 --- a/ev3/legoev3_i2c.c +++ b/ev3/legoev3_i2c.c @@ -136,7 +136,7 @@ static int i2c_legoev3_probe(struct platform_device *pdev) return ret; } -static int i2c_legoev3_remove(struct platform_device *pdev) +static void i2c_legoev3_remove(struct platform_device *pdev) { struct i2c_adapter *adap = platform_get_drvdata(pdev); struct i2c_legoev3_algo_data *adata = adap->algo_data; @@ -148,7 +148,6 @@ static int i2c_legoev3_remove(struct platform_device *pdev) kfree(adata); kfree(adap); - return 0; } static struct platform_driver i2c_legoev3_driver = { diff --git a/ev3/legoev3_sound.c b/ev3/legoev3_sound.c index 94045fb..f9ed9a4 100644 --- a/ev3/legoev3_sound.c +++ b/ev3/legoev3_sound.c @@ -613,8 +613,7 @@ static int snd_legoev3_create(struct snd_card *card, struct pwm_device *pwm, chip->pwm = pwm; chip->ena_gpio = gpio; INIT_WORK(&chip->disable_work, snd_legoev3_disable_work); - hrtimer_init(&chip->pcm_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - chip->pcm_timer.function = &snd_legoev3_pcm_timer_callback; + hrtimer_setup(&chip->pcm_timer, snd_legoev3_pcm_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL); err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); if (err < 0) @@ -664,7 +663,7 @@ static int snd_legoev3_probe(struct platform_device *pdev) pwm_apply_args(pwm); /* This lets us set the pwm duty cycle in an atomic context */ - pm_runtime_irq_safe(pwm->chip->dev); + pm_runtime_irq_safe(&pwm->chip->dev); err = pwm_enable(pwm); if (err < 0) { @@ -696,7 +695,7 @@ static int snd_legoev3_probe(struct platform_device *pdev) goto err_snd_card_new; sprintf(card->longname, "%s connected to %s", card->shortname, - dev_name(pwm->chip->dev)); + dev_name(&pwm->chip->dev)); err = snd_legoev3_create(card, pwm, ena_gpio); if (err < 0) { @@ -729,7 +728,7 @@ static int snd_legoev3_probe(struct platform_device *pdev) return err; } -static int snd_legoev3_remove(struct platform_device *pdev) +static void snd_legoev3_remove(struct platform_device *pdev) { struct snd_card *card = dev_get_drvdata(&pdev->dev); struct snd_legoev3 *chip = card->private_data; @@ -744,7 +743,6 @@ static int snd_legoev3_remove(struct platform_device *pdev) cancel_work_sync(&chip->disable_work); pwm_disable(chip->pwm); - return 0; } static const struct of_device_id of_snd_legoev3_match[] = { diff --git a/sensors/ev3_uart_sensor_ld.c b/sensors/ev3_uart_sensor_ld.c index d6f63e3..b04e50a 100644 --- a/sensors/ev3_uart_sensor_ld.c +++ b/sensors/ev3_uart_sensor_ld.c @@ -1002,9 +1002,7 @@ static int ev3_uart_open(struct tty_struct *tty) port->sensor.set_mode = ev3_uart_set_mode; port->sensor.direct_write = ev3_uart_direct_write; INIT_WORK(&port->change_bitrate_work, ev3_uart_change_bitrate_work); - hrtimer_init(&port->keep_alive_timer, HRTIMER_BASE_MONOTONIC, - HRTIMER_MODE_REL); - port->keep_alive_timer.function = ev3_uart_keep_alive_timer_callback; + hrtimer_setup(&port->keep_alive_timer, ev3_uart_keep_alive_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL); tasklet_init(&port->keep_alive_tasklet, ev3_uart_send_keep_alive, (unsigned long)tty); init_completion(&port->set_mode_completion); diff --git a/sensors/lego_sensor_class.c b/sensors/lego_sensor_class.c index 97f3d36..2d3126b 100644 --- a/sensors/lego_sensor_class.c +++ b/sensors/lego_sensor_class.c @@ -567,8 +567,8 @@ static ssize_t text_value_show(struct device *dev, struct device_attribute *attr static ssize_t bin_data_read(struct file *file, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) + const struct bin_attribute *attr, + char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); struct lego_sensor_device *sensor = to_lego_sensor_device(dev); @@ -585,8 +585,8 @@ static ssize_t bin_data_read(struct file *file, struct kobject *kobj, } static ssize_t direct_read(struct file *file, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) + const struct bin_attribute *attr, + char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); struct lego_sensor_device *sensor = to_lego_sensor_device(dev); @@ -598,8 +598,8 @@ static ssize_t direct_read(struct file *file, struct kobject *kobj, } static ssize_t direct_write(struct file *file, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) + const struct bin_attribute *attr, + char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); struct lego_sensor_device *sensor = to_lego_sensor_device(dev); @@ -667,10 +667,10 @@ static struct attribute *lego_sensor_class_attrs[] = { static BIN_ATTR_RO(bin_data, LEGO_SENSOR_RAW_DATA_SIZE); static BIN_ATTR_RW(direct, 255); -static struct bin_attribute *lego_sensor_class_bin_attrs[] = { - &bin_attr_bin_data, - &bin_attr_direct, - NULL +static const struct bin_attribute *const lego_sensor_class_bin_attrs[] = { + &bin_attr_bin_data, + &bin_attr_direct, + NULL }; static const struct attribute_group lego_sensor_class_group = { diff --git a/sensors/nxt_i2c_sensor_core.c b/sensors/nxt_i2c_sensor_core.c index 8dba1c5..08a3dd7 100644 --- a/sensors/nxt_i2c_sensor_core.c +++ b/sensors/nxt_i2c_sensor_core.c @@ -286,8 +286,7 @@ static int nxt_i2c_sensor_probe(struct i2c_client *client) } INIT_WORK(&data->poll_work, nxt_i2c_sensor_poll_work); - hrtimer_init(&data->poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - data->poll_timer.function = nxt_i2c_sensor_poll_timer; + hrtimer_setup(&data->poll_timer, nxt_i2c_sensor_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); data->poll_ms = default_poll_ms; i2c_set_clientdata(client, data);