From: Uwe Hermann Date: Sun, 30 Jan 2011 15:44:26 +0000 (+0100) Subject: Prefixes for *_device_instance. X-Git-Tag: libsigrok-0.1.0~364 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6c29007211e3a35bb90db53cd22042f04fbe4e44;p=libsigrok.git Prefixes for *_device_instance. --- diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 42779942..924ce7c1 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -436,7 +436,7 @@ static int hw_init(char *deviceinfo) /* save a pointer to our private instance data */ sdi->priv = mso; - sdi->serial = serial_device_instance_new(path, -1); + sdi->serial = sr_serial_device_instance_new(path, -1); if (!sdi->serial) goto err_device_instance_free; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index dbad1888..cf9f025a 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -96,7 +96,7 @@ static struct samplerates samplerates = { 0, }; -/* List of struct serial_device_instance */ +/* List of struct sr_serial_device_instance */ static GSList *device_instances = NULL; /* Current state of the flag register */ @@ -295,7 +295,7 @@ static int hw_init(char *deviceinfo) (final_devcnt, ST_INACTIVE, "Openbench", "Logic Sniffer", "v1.0"); - sdi->serial = serial_device_instance_new + sdi->serial = sr_serial_device_instance_new (device_names[i], -1); device_instances = g_slist_append(device_instances, sdi); diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 51375392..8a74332e 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -335,11 +335,11 @@ static int hw_init(char *deviceinfo) g_warning("firmware upload failed for " "device %d", devcnt); - sdi->usb = usb_device_instance_new + sdi->usb = sr_usb_device_instance_new (libusb_get_bus_number(devlist[i]), 0, NULL); } else { /* Already has the firmware, so fix the new address. */ - sdi->usb = usb_device_instance_new + sdi->usb = sr_usb_device_instance_new (libusb_get_bus_number(devlist[i]), libusb_get_device_address(devlist[i]), NULL); } diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 92c33204..8399292c 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -312,7 +312,7 @@ static int hw_init(char *deviceinfo) return 0; device_instances = g_slist_append(device_instances, sdi); - sdi->usb = usb_device_instance_new( + sdi->usb = sr_usb_device_instance_new( libusb_get_bus_number(devlist[i]), libusb_get_device_address(devlist[i]), NULL); devcnt++; diff --git a/hwplugin.c b/hwplugin.c index efd8f5e1..36f22016 100644 --- a/hwplugin.c +++ b/hwplugin.c @@ -139,10 +139,10 @@ void sr_device_instance_free(struct sr_device_instance *sdi) { switch (sdi->instance_type) { case USB_INSTANCE: - usb_device_instance_free(sdi->usb); + sr_usb_device_instance_free(sdi->usb); break; case SERIAL_INSTANCE: - serial_device_instance_free(sdi->serial); + sr_serial_device_instance_free(sdi->serial); break; default: /* No specific type, nothing extra to free. */ @@ -155,12 +155,12 @@ void sr_device_instance_free(struct sr_device_instance *sdi) free(sdi); } -struct usb_device_instance *usb_device_instance_new(uint8_t bus, +struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus, uint8_t address, struct libusb_device_handle *hdl) { - struct usb_device_instance *udi; + struct sr_usb_device_instance *udi; - if (!(udi = malloc(sizeof(struct usb_device_instance)))) + if (!(udi = malloc(sizeof(struct sr_usb_device_instance)))) return NULL; udi->bus = bus; @@ -170,7 +170,7 @@ struct usb_device_instance *usb_device_instance_new(uint8_t bus, return udi; } -void usb_device_instance_free(struct usb_device_instance *usb) +void sr_usb_device_instance_free(struct sr_usb_device_instance *usb) { /* Avoid compiler warnings. */ usb = usb; @@ -178,12 +178,12 @@ void usb_device_instance_free(struct usb_device_instance *usb) /* Nothing to do for this device instance type. */ } -struct serial_device_instance *serial_device_instance_new( +struct sr_serial_device_instance *sr_serial_device_instance_new( const char *port, int fd) { - struct serial_device_instance *serial; + struct sr_serial_device_instance *serial; - if (!(serial = malloc(sizeof(struct serial_device_instance)))) + if (!(serial = malloc(sizeof(struct sr_serial_device_instance)))) return NULL; serial->port = strdup(port); @@ -192,7 +192,7 @@ struct serial_device_instance *serial_device_instance_new( return serial; } -void serial_device_instance_free(struct serial_device_instance *serial) +void sr_serial_device_instance_free(struct sr_serial_device_instance *serial) { free(serial->port); } diff --git a/sigrok-proto.h b/sigrok-proto.h index 4d700f31..4c31bfe6 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -70,14 +70,14 @@ struct sr_device_instance *sr_get_device_instance(GSList *device_instances, void sr_device_instance_free(struct sr_device_instance *sdi); /* USB-specific instances */ -struct usb_device_instance *usb_device_instance_new(uint8_t bus, +struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus, uint8_t address, struct libusb_device_handle *hdl); -void usb_device_instance_free(struct usb_device_instance *usb); +void sr_usb_device_instance_free(struct sr_usb_device_instance *usb); /* Serial-specific instances */ -struct serial_device_instance *serial_device_instance_new( +struct sr_serial_device_instance *sr_serial_device_instance_new( const char *port, int fd); -void serial_device_instance_free(struct serial_device_instance *serial); +void sr_serial_device_instance_free(struct sr_serial_device_instance *serial); int find_hwcap(int *capabilities, int hwcap); struct hwcap_option *find_hwcap_option(int hwcap); diff --git a/sigrok.h b/sigrok.h index 20bd5943..f45577e7 100644 --- a/sigrok.h +++ b/sigrok.h @@ -246,8 +246,8 @@ struct sr_device_instance { char *version; void *priv; union { - struct usb_device_instance *usb; - struct serial_device_instance *serial; + struct sr_usb_device_instance *usb; + struct sr_serial_device_instance *serial; }; }; @@ -257,13 +257,13 @@ enum { SERIAL_INSTANCE, }; -struct usb_device_instance { +struct sr_usb_device_instance { uint8_t bus; uint8_t address; struct libusb_device_handle *devhdl; }; -struct serial_device_instance { +struct sr_serial_device_instance { char *port; int fd; };