Merge pull request #44 from bentiss/wip/rename_hidpp10_device_new_from_idx

hidpp10: rename hidpp10_device_new_from_idx into hidpp10_device_new
This commit is contained in:
Peter Hutterer
2015-10-21 12:53:40 +10:00
4 changed files with 7 additions and 24 deletions

View File

@@ -234,7 +234,7 @@ hidpp10drv_probe(struct ratbag_device *device)
* so even for unifying receiver devices we can just 0x00 as device
* index.
*/
dev = hidpp10_device_new_from_idx(&base, WIRED_DEVICE_IDX);
dev = hidpp10_device_new(&base, WIRED_DEVICE_IDX);
if (!dev) {
log_error(device->ratbag,

View File

@@ -1222,32 +1222,16 @@ hidpp10_get_device_info(struct hidpp10_device *dev)
return 0;
}
static struct hidpp10_device*
hidpp10_device_new(const struct hidpp_device *base,
int index)
struct hidpp10_device*
hidpp10_device_new(const struct hidpp_device *base, int idx)
{
struct hidpp10_device *dev;
dev = zalloc(sizeof(*dev));
if (!dev)
return NULL;
dev->index = index;
dev->base = *base;
return dev;
}
struct hidpp10_device*
hidpp10_device_new_from_idx(const struct hidpp_device *base, int idx)
{
struct hidpp10_device *dev;
dev = hidpp10_device_new(base, idx);
if (!dev)
return NULL;
dev->index = idx;
dev->base = *base;
if (hidpp10_get_device_info(dev) != 0) {
hidpp10_device_destroy(dev);
dev = NULL;

View File

@@ -46,8 +46,7 @@ struct hidpp10_device {
};
struct hidpp10_device*
hidpp10_device_new_from_idx(const struct hidpp_device *base,
int idx);
hidpp10_device_new(const struct hidpp_device *base, int idx);
void
hidpp10_device_destroy(struct hidpp10_device *dev);

View File

@@ -98,7 +98,7 @@ main(int argc, char **argv)
error(1, errno, "Failed to open path %s", path);
hidpp_device_init(&base, fd);
dev = hidpp10_device_new_from_idx(&base, WIRED_DEVICE_IDX);
dev = hidpp10_device_new(&base, WIRED_DEVICE_IDX);
if (argc == 2)
rc = dump_all_pages(dev);