mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
thunderbolt: Fix for v5.9-rc6
One more fix that makes ASUS PA27AC Thunderbolt 3 monitor work more reliably. This has been in linux-next with no reported issues. -----BEGIN PGP SIGNATURE----- iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAl9giR0gHG1pa2Eud2Vz dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBhFA/+KVuBU+0vneG1 77j9No3wVVYp7spGa/HORYUKuBj72IBCIxARNzyjNY3h5422aKn44F5ReuTj4TGx 414cQ1iGblZSiF8Geen0e7Oyg+KSKnenkKdiIE9oa4Hy/UPT39i7uJiDBriMc0dD PpriEEa8AMXfdjxY3WK8iynf9qoky1S2EHBo8Rz9nCQkQ+yOEKfZq8KC+Egb9XFV ebRsRj7rM4V9VNhETnfTm54M2zPw8n7HDKkQB1z8qddyv9i6biHTFXXXRD8A/Q/7 ZrC7fW/OqUVra34bV70tGD3goSAi7kfHyMF4C4+dUhCP8lF36ozLqh/3cUt+5TOE ghpuHNsAb35PZu70h3U4hBTn9j/KtWgo6JH++xv6TkuffPEFWo1FSuPmupKg1WZK XMJ0CtwBeUM2JF2sXKlaUrjFsql7mxoRbnBjkp/giP9PiW7QXZzkl2Y8DgCvmDmF mBJj4rKu/oBBjs8NyD41roY2e+02DYIos5UzkYZl2/68Vv6USa601nG580gA6dBb Y/8RoaCFIxl3WK26+Ri08190BNlwMlVcX8ToaM9rroCI+9eDqsa5G8eb9zLmcWwC +tTNJMMFsho2Js+DxOcJXY0LoQeNrNazFKylz6UnsgL7zsw0kI0dM3l3qpRysqha Ua06NbrPEpqhQ62xKXtj7qAiWdIIZAo= =sgTO -----END PGP SIGNATURE----- Merge tag 'thunderbolt-for-v5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus Mika writes: thunderbolt: Fix for v5.9-rc6 One more fix that makes ASUS PA27AC Thunderbolt 3 monitor work more reliably. This has been in linux-next with no reported issues. * tag 'thunderbolt-for-v5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Retry DROM read once if parsing fails
This commit is contained in:
commit
bf638d736e
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/slab.h>
|
||||
#include "tb.h"
|
||||
@ -389,8 +390,8 @@ static int tb_drom_parse_entries(struct tb_switch *sw)
|
||||
struct tb_drom_entry_header *entry = (void *) (sw->drom + pos);
|
||||
if (pos + 1 == drom_size || pos + entry->len > drom_size
|
||||
|| !entry->len) {
|
||||
tb_sw_warn(sw, "drom buffer overrun, aborting\n");
|
||||
return -EIO;
|
||||
tb_sw_warn(sw, "DROM buffer overrun\n");
|
||||
return -EILSEQ;
|
||||
}
|
||||
|
||||
switch (entry->type) {
|
||||
@ -526,7 +527,8 @@ int tb_drom_read(struct tb_switch *sw)
|
||||
u16 size;
|
||||
u32 crc;
|
||||
struct tb_drom_header *header;
|
||||
int res;
|
||||
int res, retries = 1;
|
||||
|
||||
if (sw->drom)
|
||||
return 0;
|
||||
|
||||
@ -612,7 +614,17 @@ int tb_drom_read(struct tb_switch *sw)
|
||||
tb_sw_warn(sw, "drom device_rom_revision %#x unknown\n",
|
||||
header->device_rom_revision);
|
||||
|
||||
return tb_drom_parse_entries(sw);
|
||||
res = tb_drom_parse_entries(sw);
|
||||
/* If the DROM parsing fails, wait a moment and retry once */
|
||||
if (res == -EILSEQ && retries--) {
|
||||
tb_sw_warn(sw, "parsing DROM failed, retrying\n");
|
||||
msleep(100);
|
||||
res = tb_drom_read_n(sw, 0, sw->drom, size);
|
||||
if (!res)
|
||||
goto parse;
|
||||
}
|
||||
|
||||
return res;
|
||||
err:
|
||||
kfree(sw->drom);
|
||||
sw->drom = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user