The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / sane-backends / 0001-qcam-x86.patch
1 [PATCH] backend/qcam.c: fix build on !x86
2
3 inb/outb/ioperm are x86 specific interfaces, so replace with noops on
4 !x86.
5
6 Inspired by similar patch in openwrt:
7 https://dev.openwrt.org/ticket/5689
8
9 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
10 ---
11  backend/qcam.c |   14 +++++++++++++-
12  1 file changed, 13 insertions(+), 1 deletion(-)
13
14 Index: sane-backends-1.0.22/backend/qcam.c
15 ===================================================================
16 --- sane-backends-1.0.22.orig/backend/qcam.c
17 +++ sane-backends-1.0.22/backend/qcam.c
18 @@ -205,12 +205,20 @@
19  
20  #endif /* <sys/io.h> || <asm/io.h> || <sys/hw.h> */
21  
22 +/* inb / outb only exist on x86 */
23 +#if defined(__i386__) || defined(__x86_64__)
24  #define read_lpdata(d)         inb ((d)->port)
25  #define read_lpstatus(d)       inb ((d)->port + 1)
26  #define read_lpcontrol(d)      inb ((d)->port + 2)
27  #define write_lpdata(d,v)      outb ((v), (d)->port)
28  #define write_lpcontrol(d,v)   outb ((v), (d)->port + 2)
29 -
30 +#else
31 +#define read_lpdata(d)         0
32 +#define read_lpstatus(d)       0
33 +#define read_lpcontrol(d)      0
34 +#define write_lpdata(d,v)
35 +#define write_lpcontrol(d,v)
36 +#endif
37  
38  static SANE_Status
39  enable_ports (QC_Device * q)
40 @@ -219,8 +227,10 @@
41    if (q->port < 0x278 || q->port > 0x3bc)
42      return SANE_STATUS_INVAL;
43  
44 +#if defined(__i386__) || defined(__x86_64__)
45    if (ioperm (q->port, 3, 1) < 0)
46      return SANE_STATUS_INVAL;
47 +#endif
48  
49    return SANE_STATUS_GOOD;
50  }
51 @@ -228,8 +238,10 @@
52  static SANE_Status
53  disable_ports (QC_Device * q)
54  {
55 +#if defined(__i386__) || defined(__x86_64__)
56    if (ioperm (q->port, 3, 0) < 0)
57      return SANE_STATUS_INVAL;
58 +#endif
59  
60    return SANE_STATUS_GOOD;
61  }