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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 295316c3f44c3e779e85d7453424496a3bb4bc48 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sat, 8 Aug 2015 22:56:09 +0200
  4. Subject: [PATCH] Fix build on SPARC
  5. On SPARC, the definitions of B2500000, B3000000, B3500000 and B4000000
  6. are not necessarily available, so use those values only if defined in
  7. the kernel headers.
  8. It fixes SPARC build failures such as:
  9. src/serial.c: In function '_serial_baudrate_to_bits':
  10. src/serial.c:73:30: error: 'B2500000' undeclared (first use in this function)
  11. case 2500000: return B2500000;
  12. ^
  13. src/serial.c:73:30: note: each undeclared identifier is reported only once for each function it appears in
  14. src/serial.c:74:30: error: 'B3000000' undeclared (first use in this function)
  15. case 3000000: return B3000000;
  16. ^
  17. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  18. ---
  19. src/serial.c | 16 ++++++++++++++++
  20. 1 file changed, 16 insertions(+)
  21. diff --git a/src/serial.c b/src/serial.c
  22. index e385309..efd425e 100644
  23. --- a/src/serial.c
  24. +++ b/src/serial.c
  25. @@ -70,10 +70,18 @@ static int _serial_baudrate_to_bits(uint32_t baudrate) {
  26. case 1152000: return B1152000;
  27. case 1500000: return B1500000;
  28. case 2000000: return B2000000;
  29. +#ifdef B2500000
  30. case 2500000: return B2500000;
  31. +#endif
  32. +#ifdef B3000000
  33. case 3000000: return B3000000;
  34. +#endif
  35. +#ifdef B3500000
  36. case 3500000: return B3500000;
  37. +#endif
  38. +#ifdef B4000000
  39. case 4000000: return B4000000;
  40. +#endif
  41. default: return -1;
  42. }
  43. }
  44. @@ -107,10 +115,18 @@ static int _serial_bits_to_baudrate(uint32_t bits) {
  45. case B1152000: return 1152000;
  46. case B1500000: return 1500000;
  47. case B2000000: return 2000000;
  48. +#ifdef B2500000
  49. case B2500000: return 2500000;
  50. +#endif
  51. +#ifdef B3000000
  52. case B3000000: return 3000000;
  53. +#endif
  54. +#ifdef B3500000
  55. case B3500000: return 3500000;
  56. +#endif
  57. +#ifdef B4000000
  58. case B4000000: return 4000000;
  59. +#endif
  60. default: return -1;
  61. }
  62. }
  63. --
  64. 2.5.0