From 1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2024 19:44:18 +0200 Subject: Merging upstream version 4.2.4. Signed-off-by: Daniel Baumann --- tools/make-pci-ids.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tools/make-pci-ids.py') diff --git a/tools/make-pci-ids.py b/tools/make-pci-ids.py index 0a77f766..093637d7 100755 --- a/tools/make-pci-ids.py +++ b/tools/make-pci-ids.py @@ -44,7 +44,7 @@ typedef struct uint16_t did; uint16_t svid; uint16_t ssid; - char *name; + const char *name; } pci_id_t; @@ -52,14 +52,14 @@ typedef struct { uint16_t vid; uint16_t count; - pci_id_t *ids_ptr; + pci_id_t const *ids_ptr; } pci_vid_index_t; """ CODE_POSTFIX = """ -static pci_vid_index_t *get_vid_index(uint16_t vid) +static pci_vid_index_t const *get_vid_index(uint16_t vid) { uint32_t start_index = 0; uint32_t end_index = 0; @@ -96,9 +96,9 @@ static pci_vid_index_t *get_vid_index(uint16_t vid) const char *pci_id_str(uint16_t vid, uint16_t did, uint16_t svid, uint16_t ssid) { unsigned int i; - static char *not_found = \"Not found\"; - pci_vid_index_t *index_ptr; - pci_id_t *ids_ptr; + static const char *not_found = \"Not found\"; + pci_vid_index_t const *index_ptr; + pci_id_t const *ids_ptr; index_ptr = get_vid_index(vid); @@ -184,7 +184,7 @@ def main(): did = -1 svid = -1 ssid = -1 - out_lines += "pci_id_t pci_vid_%04X[] = {\n" % (vid) + out_lines += "static pci_id_t const pci_vid_%04X[] = {\n" % (vid) out_lines += "{0x%04X, 0xFFFF, 0xFFFF, 0xFFFF, \"%s(0x%04X)\"},\n" % (vid, words[1].strip(), vid) id_list.append(vid) continue @@ -227,7 +227,7 @@ def main(): out_lines += "}; /* pci_vid_%04X[] */\n" % (vid) count_list.append(entries) - out_lines += "\npci_vid_index_t pci_vid_index[] = {\n" + out_lines += "\nstatic pci_vid_index_t const pci_vid_index[] = {\n" vendor_count = len(id_list) device_count = 0 @@ -240,10 +240,10 @@ def main(): out_lines += CODE_POSTFIX if vendor_count < MIN_VENDOR_COUNT: - exit_msg(f'Too view vendors. Wanted {MIN_VENDOR_COUNT}, got {vendor_count}.') + exit_msg(f'Too few vendors. Wanted {MIN_VENDOR_COUNT}, got {vendor_count}.') if device_count < MIN_DEVICE_COUNT: - exit_msg(f'Too view devices. Wanted {MIN_DEVICE_COUNT}, got {device_count}.') + exit_msg(f'Too few devices. Wanted {MIN_DEVICE_COUNT}, got {device_count}.') with open(OUTPUT_FILE, "w", encoding="utf-8") as pci_ids_f: pci_ids_f.write(out_lines) -- cgit v1.2.3