Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/lego_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion core/lego_port_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ int lego_port_register(struct lego_port_device *port,
{
int err;

if (!port || !port->name || !port->address || !type || !parent)
if (!port || !port->name || !type || !parent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing port->address?

return -EINVAL;

port->dev.release = lego_port_release;
Expand Down
3 changes: 1 addition & 2 deletions ev3/ev3_ports_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
6 changes: 2 additions & 4 deletions ev3/ev3_ports_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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);

Expand All @@ -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[] = {
Expand Down
12 changes: 5 additions & 7 deletions ev3/ev3_ports_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_might_sleep(data->pwm, &state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want the atomic version here.

}

static struct dc_motor_ops ev3_output_port_motor_ops = {
Expand Down Expand Up @@ -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",
Expand All @@ -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);
Expand All @@ -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);

Expand All @@ -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[] = {
Expand Down
3 changes: 1 addition & 2 deletions ev3/legoev3_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand Down
10 changes: 4 additions & 6 deletions ev3/legoev3_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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[] = {
Expand Down
4 changes: 1 addition & 3 deletions sensors/ev3_uart_sensor_ld.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions sensors/lego_sensor_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down
3 changes: 1 addition & 2 deletions sensors/nxt_i2c_sensor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down