0002-Fix-build-on-SPARC.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [PATCH] Fix build on SPARC
  2. On SPARC, the definitions of B2500000, B3000000, B3500000 and B4000000
  3. are not necessarily available, so use those values only if defined in
  4. the kernel headers.
  5. It fixes SPARC build failures such as:
  6. src/serial.c: In function '_serial_baudrate_to_bits':
  7. src/serial.c:73:30: error: 'B2500000' undeclared (first use in this function)
  8. case 2500000: return B2500000;
  9. ^
  10. src/serial.c:73:30: note: each undeclared identifier is reported only once for each function it appears in
  11. src/serial.c:74:30: error: 'B3000000' undeclared (first use in this function)
  12. case 3000000: return B3000000;
  13. ^
  14. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  15. Index: b/lua-periphery/c-periphery/src/serial.c
  16. ===================================================================
  17. --- a/lua-periphery/c-periphery/src/serial.c
  18. +++ b/lua-periphery/c-periphery/src/serial.c
  19. @@ -70,10 +70,18 @@
  20. case 1152000: return B1152000;
  21. case 1500000: return B1500000;
  22. case 2000000: return B2000000;
  23. +#ifdef B2500000
  24. case 2500000: return B2500000;
  25. +#endif
  26. +#ifdef B3000000
  27. case 3000000: return B3000000;
  28. +#endif
  29. +#ifdef B3500000
  30. case 3500000: return B3500000;
  31. +#endif
  32. +#ifdef B4000000
  33. case 4000000: return B4000000;
  34. +#endif
  35. default: return -1;
  36. }
  37. }
  38. @@ -107,10 +115,18 @@
  39. case B1152000: return 1152000;
  40. case B1500000: return 1500000;
  41. case B2000000: return 2000000;
  42. +#ifdef B2500000
  43. case B2500000: return 2500000;
  44. +#endif
  45. +#ifdef B3000000
  46. case B3000000: return 3000000;
  47. +#endif
  48. +#ifdef B3500000
  49. case B3500000: return 3500000;
  50. +#endif
  51. +#ifdef B4000000
  52. case B4000000: return 4000000;
  53. +#endif
  54. default: return -1;
  55. }
  56. }