mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Drop device/profile arguments from driver read_button/write_button
The button struct contains references to both. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -320,9 +320,10 @@ etekcity_button_to_index(unsigned button)
|
||||
}
|
||||
|
||||
static void
|
||||
etekcity_read_button(struct ratbag_device *device, struct ratbag_profile *profile,
|
||||
struct ratbag_button *button)
|
||||
etekcity_read_button(struct ratbag_button *button)
|
||||
{
|
||||
struct ratbag_device *device = button->device;
|
||||
struct ratbag_profile *profile = button->profile;
|
||||
struct etekcity_data *drv_data = ratbag_get_drv_data(device);
|
||||
uint8_t data;
|
||||
unsigned index = etekcity_button_to_index(button->index);
|
||||
@@ -336,9 +337,10 @@ etekcity_read_button(struct ratbag_device *device, struct ratbag_profile *profil
|
||||
}
|
||||
|
||||
static int
|
||||
etekcity_write_button(struct ratbag_device *device, struct ratbag_profile *profile,
|
||||
struct ratbag_button *button)
|
||||
etekcity_write_button(struct ratbag_button *button)
|
||||
{
|
||||
struct ratbag_device *device = button->device;
|
||||
struct ratbag_profile *profile = button->profile;
|
||||
struct etekcity_data *drv_data = ratbag_get_drv_data(device);
|
||||
uint8_t *data;
|
||||
unsigned index = etekcity_button_to_index(button->index);
|
||||
|
||||
@@ -150,8 +150,7 @@ struct ratbag_driver {
|
||||
* actually read the profile from the device. The caller
|
||||
* should make sure that the profile is up to date.
|
||||
*/
|
||||
void (*read_button)(struct ratbag_device *device, struct ratbag_profile *profile,
|
||||
struct ratbag_button *button);
|
||||
void (*read_button)(struct ratbag_button *button);
|
||||
|
||||
/** For the given button, store in the profile or in the device
|
||||
* the given struct ratbag_button.
|
||||
@@ -164,8 +163,7 @@ struct ratbag_driver {
|
||||
* should later on write the profile in one call to
|
||||
* .write_profile().
|
||||
*/
|
||||
int (*write_button)(struct ratbag_device *device, struct ratbag_profile *profile,
|
||||
struct ratbag_button *button);
|
||||
int (*write_button)(struct ratbag_button *button);
|
||||
|
||||
/* private */
|
||||
struct list link;
|
||||
|
||||
@@ -581,7 +581,7 @@ ratbag_create_button(struct ratbag_device *device, struct ratbag_profile *profil
|
||||
list_insert(&profile->buttons, &button->link);
|
||||
|
||||
if (device->driver->read_button)
|
||||
device->driver->read_button(device, profile, button);
|
||||
device->driver->read_button(button);
|
||||
|
||||
return button;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ ratbag_profile_get_button_by_index(struct ratbag_profile *profile,
|
||||
list_for_each(button, &profile->buttons, link) {
|
||||
if (button->index == index) {
|
||||
if (profile->device->driver->read_button)
|
||||
profile->device->driver->read_button(profile->device, profile, button);
|
||||
profile->device->driver->read_button(button);
|
||||
return ratbag_button_ref(button);
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ ratbag_button_set_type(struct ratbag_button *button, enum ratbag_button_type typ
|
||||
return -ENOTSUP;
|
||||
|
||||
button->type = type;
|
||||
rc = button->device->driver->write_button(button->device, button->profile, button);
|
||||
rc = button->device->driver->write_button(button);
|
||||
if (rc)
|
||||
button->type = orig_type;
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user