~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to modules/linux/shared/compat_pci.h

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#include "compat_ioport.h"
27
27
#include <linux/pci.h>
28
 
#ifndef KERNEL_2_1
29
 
#   include <linux/bios32.h>
30
 
#endif
31
 
 
32
 
#if KERNEL_VERSION(2, 6, 6) <= LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
33
 
#   ifndef DMA_BIT_MASK
34
 
#      define DMA_BIT_MASK(n) DMA_##n##BIT_MASK
35
 
#   endif
36
 
#endif
37
 
 
38
 
 
39
 
/* 2.0.x has useless struct pci_dev; remap it to our own */
40
 
#ifndef KERNEL_2_1
41
 
#define pci_dev    vmw_pci_driver_instance
42
 
#endif
43
 
 
44
 
 
45
 
/* 2.0/2.2 does not have pci driver API */
46
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
47
 
struct vmw_pci_driver_instance {
48
 
   struct vmw_pci_driver_instance *next;
49
 
   void                   *driver_data;
50
 
   struct pci_driver      *pcidrv;
51
 
#ifdef KERNEL_2_1
52
 
   struct pci_dev         *pcidev;
53
 
#else
54
 
   unsigned char           bus;
55
 
   unsigned char           devfn;
56
 
   unsigned int            irq;
57
 
#endif
58
 
};
59
 
#endif
60
 
 
61
 
 
62
 
/* 2.0 has pcibios_* calls only...  We have to provide pci_* compatible wrappers. */
63
 
#ifndef KERNEL_2_1
64
 
static inline int
65
 
pci_read_config_byte(struct pci_dev *pdev,  // IN: PCI slot
66
 
                     unsigned char   where, // IN: Byte to read
67
 
                     u8             *value) // OUT: Value read
68
 
{
69
 
   return pcibios_read_config_byte(pdev->bus, pdev->devfn, where, value);
70
 
}
71
 
 
72
 
static inline int
73
 
pci_read_config_dword(struct pci_dev *pdev,  // IN: PCI slot
74
 
                      unsigned char   where, // IN: Dword to read
75
 
                      u32            *value) // OUT: Value read
76
 
{
77
 
   return pcibios_read_config_dword(pdev->bus, pdev->devfn, where, value);
78
 
}
79
 
 
80
 
static inline int
81
 
pci_write_config_dword(struct pci_dev *pdev,  // IN: PCI slot
82
 
                       unsigned char   where, // IN: Dword to write
83
 
                       u32             value) // IN: Value to write
84
 
{
85
 
   return pcibios_write_config_dword(pdev->bus, pdev->devfn, where, value);
86
 
}
87
 
#endif
88
 
 
89
 
 
90
 
/*
91
 
 *-----------------------------------------------------------------------------
92
 
 *
93
 
 * compat_pci_name --
94
 
 *
95
 
 *      Return human readable PCI slot name.  Note that some implementations
96
 
 *      return a pointer to the static storage, so returned value may be
97
 
 *      overwritten by subsequent calls to this function.
98
 
 *
99
 
 * Results:
100
 
 *      Returns pointer to the string with slot name.
101
 
 *
102
 
 * Side effects:
103
 
 *      None.
104
 
 *
105
 
 *-----------------------------------------------------------------------------
106
 
 */
107
 
 
108
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
109
 
#define compat_pci_name(pdev) pci_name(pdev)
110
 
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
111
 
#define compat_pci_name(pdev) (pdev)->slot_name
112
 
#elif defined(KERNEL_2_1)
113
 
static inline const char*
114
 
compat_pci_name(struct pci_dev* pdev)
115
 
{
116
 
   static char slot_name[12];
117
 
   sprintf(slot_name, "%02X:%02X.%X", pdev->bus->number,
118
 
           PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
119
 
   return slot_name;
120
 
}
121
 
#else
122
 
static inline const char*
123
 
compat_pci_name(struct pci_dev* pdev)
124
 
{
125
 
   static char slot_name[12];
126
 
   sprintf(slot_name, "%02X:%02X.%X", pdev->bus,
127
 
           PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
128
 
   return slot_name;
129
 
}
130
 
#endif
131
 
 
132
 
 
133
 
/* pci_resource_start comes in 4 flavors - 2.0, 2.2, early 2.3, 2.4+ */
134
 
#ifndef KERNEL_2_1
135
 
static inline unsigned long
136
 
compat_pci_resource_start(struct pci_dev *pdev,
137
 
                          unsigned int    index)
138
 
{
139
 
   u32 addr;
140
 
 
141
 
   if (pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0 + index * 4, &addr)) {
142
 
      printk(KERN_ERR "Unable to read base address %u from PCI slot %s!\n",
143
 
             index, compat_pci_name(pdev));
144
 
      return ~0UL;
145
 
   }
146
 
   if (addr & PCI_BASE_ADDRESS_SPACE) {
147
 
      return addr & PCI_BASE_ADDRESS_IO_MASK;
148
 
   } else {
149
 
      return addr & PCI_BASE_ADDRESS_MEM_MASK;
150
 
   }
151
 
}
152
 
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 1)
153
 
#   define compat_pci_resource_start(dev, index) \
154
 
       (((dev)->base_address[index] & PCI_BASE_ADDRESS_SPACE) \
155
 
          ? ((dev)->base_address[index] & PCI_BASE_ADDRESS_IO_MASK) \
156
 
          : ((dev)->base_address[index] & PCI_BASE_ADDRESS_MEM_MASK))
157
 
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43)
158
 
#   define compat_pci_resource_start(dev, index) \
159
 
       ((dev)->resource[index].start)
160
 
#else
161
 
#   define compat_pci_resource_start(dev, index) \
162
 
       pci_resource_start(dev, index)
163
 
#endif
164
 
 
165
 
/* since 2.3.15, a new set of s/w res flags IORESOURCE_ is introduced,
166
 
 * we fake them by returning either IORESOURCE_{IO, MEM} prior to 2.3.15 since
167
 
 * this is what compat_pci_request_region uses
168
 
 */
169
 
#ifndef KERNEL_2_1
170
 
static inline unsigned long
171
 
compat_pci_resource_flags(struct pci_dev *pdev,
172
 
                          unsigned int    index)
173
 
{
174
 
   u32 addr;
175
 
 
176
 
   if (pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0 + index * 4, &addr)) {
177
 
      printk(KERN_ERR "Unable to read base address %u from PCI slot %s!\n",
178
 
             index, compat_pci_name(pdev));
179
 
      return ~0UL;
180
 
   }
181
 
   if (addr & PCI_BASE_ADDRESS_SPACE) {
182
 
      return IORESOURCE_IO;
183
 
   } else {
184
 
      return IORESOURCE_MEM;
185
 
   }
186
 
}
187
 
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 1)
188
 
#   define compat_pci_resource_flags(dev, index) \
189
 
       (((dev)->base_address[index] & PCI_BASE_ADDRESS_SPACE) \
190
 
          ? IORESOURCE_IO: IORESOURCE_MEM)
191
 
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 15)
192
 
    /* IORESOURCE_xxx appeared in 2.3.15 and is set in resource[].flags */
193
 
#   define compat_pci_resource_flags(dev, index) ((dev)->resource[index].flags)
194
 
#else
195
 
#   define compat_pci_resource_flags(dev, index) pci_resource_flags(dev, index)
196
 
#endif
197
 
 
198
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
199
 
static inline unsigned long
200
 
compat_pci_resource_len(struct pci_dev *pdev,  // IN
201
 
                        unsigned int    index) // IN
202
 
{
203
 
   u32 addr, mask;
204
 
   unsigned char reg = PCI_BASE_ADDRESS_0 + index * 4;
205
 
 
206
 
   if (pci_read_config_dword(pdev, reg, &addr) || addr == 0xFFFFFFFF) {
207
 
      return 0;
208
 
   }
209
 
 
210
 
   pci_write_config_dword(pdev, reg, 0xFFFFFFFF);
211
 
   pci_read_config_dword(pdev, reg, &mask);
212
 
   pci_write_config_dword(pdev, reg, addr);
213
 
 
214
 
   if (mask == 0 || mask == 0xFFFFFFFF) {
215
 
      return 0;
216
 
   }
217
 
   if (addr & PCI_BASE_ADDRESS_SPACE) {
218
 
      return 65536 - (mask & PCI_BASE_ADDRESS_IO_MASK & 0xFFFF);
219
 
   } else {
220
 
      return -(mask & PCI_BASE_ADDRESS_MEM_MASK);
221
 
   }
222
 
}
223
 
#else
224
 
#define compat_pci_resource_len(dev, index) pci_resource_len(dev, index)
225
 
#endif
226
 
 
227
 
/* pci_request_region appears in 2.4.20 */
228
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 20)
229
 
static inline int
230
 
compat_pci_request_region(struct pci_dev *pdev, int bar, char *name)
231
 
{
232
 
   if (compat_pci_resource_len(pdev, bar) == 0) {
233
 
      return 0;
234
 
   }
235
 
 
236
 
   if (compat_pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
237
 
      if (!compat_request_region(compat_pci_resource_start(pdev, bar),
238
 
                                 compat_pci_resource_len(pdev, bar),
239
 
                                 name)) {
240
 
         return -EBUSY;
241
 
      }
242
 
   } else if (compat_pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
243
 
      if (!compat_request_mem_region(compat_pci_resource_start(pdev, bar),
244
 
                                     compat_pci_resource_len(pdev, bar),
245
 
                                     name)) {
246
 
         return -EBUSY;
247
 
      }
248
 
   }
249
 
 
250
 
   return 0;
251
 
}
252
 
 
253
 
static inline void
254
 
compat_pci_release_region(struct pci_dev *pdev, int bar)
255
 
{
256
 
   if (compat_pci_resource_len(pdev, bar) != 0) {
257
 
      if (compat_pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
258
 
         release_region(compat_pci_resource_start(pdev, bar),
259
 
                        compat_pci_resource_len(pdev, bar));
260
 
      } else if (compat_pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
261
 
         compat_release_mem_region(compat_pci_resource_start(pdev, bar),
262
 
                                   compat_pci_resource_len(pdev, bar));
263
 
      }
264
 
   }
265
 
}
266
 
#else
267
 
#define compat_pci_request_region(pdev, bar, name)  pci_request_region(pdev, bar, name)
268
 
#define compat_pci_release_region(pdev, bar)        pci_release_region(pdev, bar)
269
 
#endif
270
 
 
271
 
/* pci_request_regions appeears in 2.4.3 */
272
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)
273
 
static inline int
274
 
compat_pci_request_regions(struct pci_dev *pdev, char *name)
275
 
{
276
 
   int i;
277
 
   
278
 
   for (i = 0; i < 6; i++) {
279
 
      if (compat_pci_request_region(pdev, i, name)) {
280
 
         goto release;
281
 
      }
282
 
   }
283
 
   return 0;
284
 
 
285
 
release:
286
 
   while (--i >= 0) {
287
 
      compat_pci_release_region(pdev, i);
288
 
   }
289
 
   return -EBUSY;
290
 
}
291
 
static inline void
292
 
compat_pci_release_regions(struct pci_dev *pdev)
293
 
{
294
 
   int i;
295
 
   
296
 
   for (i = 0; i < 6; i++) {
297
 
      compat_pci_release_region(pdev, i);
298
 
   }
299
 
}
300
 
#else
301
 
#define compat_pci_request_regions(pdev, name) pci_request_regions(pdev, name)
302
 
#define compat_pci_release_regions(pdev)       pci_release_regions(pdev)
303
 
#endif
304
 
 
305
 
/* pci_enable_device is available since 2.4.0 */
306
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
307
 
#define compat_pci_enable_device(pdev) (0)
308
 
#else
309
 
#define compat_pci_enable_device(pdev) pci_enable_device(pdev)
310
 
#endif
311
 
 
312
 
 
313
 
/* pci_set_master is available since 2.2.0 */
314
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 0)
315
 
#define compat_pci_set_master(pdev) (0)
316
 
#else
317
 
#define compat_pci_set_master(pdev) pci_set_master(pdev)
318
 
#endif
319
 
 
320
 
 
321
 
/* pci_disable_device is available since 2.4.4 */
322
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 4)
323
 
#define compat_pci_disable_device(pdev) do {} while (0)
324
 
#else
325
 
#define compat_pci_disable_device(pdev) pci_disable_device(pdev)
326
 
#endif
327
 
 
328
 
 
329
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
330
 
/*
331
 
 * Devices supported by particular pci driver.  While 2.4+ kernels
332
 
 * can do match on subsystem and class too, we support match on
333
 
 * vendor/device IDs only.
334
 
 */
335
 
struct pci_device_id {
336
 
   unsigned int vendor, device;
337
 
   unsigned long driver_data;
338
 
};
339
 
#define PCI_DEVICE(vend, dev)   .vendor = (vend), .device = (dev)
340
 
 
341
 
/* PCI driver */
342
 
struct pci_driver {
343
 
   const char *name;
344
 
   const struct pci_device_id *id_table;
345
 
   int   (*probe)(struct pci_dev* dev, const struct pci_device_id* id);
346
 
   void  (*remove)(struct pci_dev* dev);
347
 
};
348
 
 
349
 
 
350
 
/*
351
 
 * Note that this is static variable.  Maybe everything below should be in
352
 
 * separate compat_pci.c file, but currently only user of this file is vmxnet,
353
 
 * and vmxnet has only one file, so it is fine.  Also with vmxnet all
354
 
 * functions below are called just once, so difference between 'inline' and
355
 
 * separate compat_pci.c should be very small.
356
 
 */
357
 
 
358
 
static struct vmw_pci_driver_instance *pci_driver_instances = NULL;
359
 
 
360
 
#ifdef KERNEL_2_1
361
 
#define vmw_pci_device(instance) (instance)->pcidev
362
 
#else
363
 
#define vmw_pci_device(instance) (instance)
364
 
#endif
365
 
 
366
 
 
367
 
/*
368
 
 *-----------------------------------------------------------------------------
369
 
 *
370
 
 * pci_register_driver --
371
 
 *
372
 
 *      Create driver instances for all matching PCI devices in the box.
373
 
 *
374
 
 * Results:
375
 
 *      Returns 0 for success, negative error value for failure.
376
 
 *
377
 
 * Side effects:
378
 
 *      None.
379
 
 *
380
 
 *-----------------------------------------------------------------------------
381
 
 */
382
 
 
383
 
static inline int
384
 
pci_register_driver(struct pci_driver *drv)
385
 
{
386
 
   const struct pci_device_id *chipID;
387
 
 
388
 
   for (chipID = drv->id_table; chipID->vendor; chipID++) {
389
 
#ifdef KERNEL_2_1
390
 
      struct pci_dev *pdev;
391
 
 
392
 
      for (pdev = NULL;
393
 
           (pdev = pci_find_device(chipID->vendor, chipID->device, pdev)) != NULL; ) {
394
 
#else
395
 
      int adapter;
396
 
      unsigned char bus, devfn, irq;
397
 
 
398
 
      for (adapter = 0;
399
 
           pcibios_find_device(chipID->vendor, chipID->device, adapter,
400
 
                               &bus, &devfn) == 0;
401
 
           adapter++) {
402
 
#endif
403
 
         struct vmw_pci_driver_instance *pdi;
404
 
         int err;
405
 
 
406
 
         pdi = kmalloc(sizeof *pdi, GFP_KERNEL);
407
 
         if (!pdi) {
408
 
            printk(KERN_ERR "Not enough memory.\n");
409
 
            break;
410
 
         }
411
 
         pdi->pcidrv = drv;
412
 
#ifdef KERNEL_2_1
413
 
         pdi->pcidev = pdev;
414
 
#else
415
 
         pdi->bus = bus;
416
 
         pdi->devfn = devfn;
417
 
         if (pci_read_config_byte(pdi, PCI_INTERRUPT_LINE, &irq)) {
418
 
            pdi->irq = -1;
419
 
         } else {
420
 
            pdi->irq = irq;
421
 
         }
422
 
#endif
423
 
         pdi->driver_data = NULL;
424
 
         pdi->next = pci_driver_instances;
425
 
         pci_driver_instances = pdi;
426
 
         err = drv->probe(vmw_pci_device(pdi), chipID);
427
 
         if (err) {
428
 
            pci_driver_instances = pdi->next;
429
 
            kfree(pdi);
430
 
         }
431
 
      }
432
 
   }
433
 
   return 0;
434
 
}
435
 
 
436
 
 
437
 
/*
438
 
 *-----------------------------------------------------------------------------
439
 
 *
440
 
 * compat_pci_unregister_driver --
441
 
 *
442
 
 *      Shut down PCI driver - unbind all device instances from driver.
443
 
 *
444
 
 * Results:
445
 
 *      None.
446
 
 *
447
 
 * Side effects:
448
 
 *      None.
449
 
 *
450
 
 *-----------------------------------------------------------------------------
451
 
 */
452
 
 
453
 
static inline void
454
 
pci_unregister_driver(struct pci_driver *drv)
455
 
{
456
 
   struct vmw_pci_driver_instance **ppdi;
457
 
 
458
 
   ppdi = &pci_driver_instances;
459
 
   while (1) {
460
 
      struct vmw_pci_driver_instance *pdi = *ppdi;
461
 
 
462
 
      if (!pdi) {
463
 
         break;
464
 
      }
465
 
      if (pdi->pcidrv == drv) {
466
 
         drv->remove(vmw_pci_device(pdi));
467
 
         *ppdi = pdi->next;
468
 
         kfree(pdi);
469
 
      } else {
470
 
         ppdi = &pdi->next;
471
 
      }
472
 
   }
473
 
}
474
 
#else
475
 
/* provide PCI_DEVICE for early 2.4.x kernels */
476
 
#ifndef PCI_DEVICE
477
 
#define PCI_DEVICE(vend, dev)   .vendor = (vend), .device = (dev), \
478
 
                                .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
479
 
#endif
480
 
#endif
481
 
 
482
 
 
483
 
/* provide dummy MODULE_DEVICE_TABLE for 2.0/2.2 */
484
 
#ifndef MODULE_DEVICE_TABLE
485
 
#define MODULE_DEVICE_TABLE(bus, devices)
486
 
#endif
487
 
 
488
 
 
489
 
/*
490
 
 *-----------------------------------------------------------------------------
491
 
 *
492
 
 * pci_set_drvdata --
493
 
 *
494
 
 *      Set per-device driver's private data.
495
 
 *
496
 
 * Results:
497
 
 *      None.
498
 
 *
499
 
 * Side effects:
500
 
 *      None.
501
 
 *
502
 
 *-----------------------------------------------------------------------------
503
 
 */
504
 
 
505
 
/*
506
 
 *-----------------------------------------------------------------------------
507
 
 *
508
 
 * pci_get_drvdata --
509
 
 *
510
 
 *      Retrieve per-device driver's private data.
511
 
 *
512
 
 * Results:
513
 
 *      per-device driver's data previously set by pci_set_drvdata,
514
 
 *      or NULL on failure.
515
 
 *
516
 
 * Side effects:
517
 
 *      None.
518
 
 *
519
 
 *-----------------------------------------------------------------------------
520
 
 */
521
 
 
522
 
#ifndef KERNEL_2_1
523
 
/* 2.0.x is simple, we have driver_data directly in pci_dev */
524
 
#define pci_set_drvdata(pdev, data) do { (pdev)->driver_data = (data); } while (0)
525
 
#define pci_get_drvdata(pdev)       (pdev)->driver_data
526
 
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
527
 
/* 2.2.x is trickier, we have to find driver instance first */
528
 
static inline void
529
 
pci_set_drvdata(struct pci_dev *pdev, void* data)
530
 
{
531
 
   struct vmw_pci_driver_instance *pdi;
532
 
 
533
 
   for (pdi = pci_driver_instances; pdi; pdi = pdi->next) {
534
 
      if (pdi->pcidev == pdev) {
535
 
         pdi->driver_data = data;
536
 
         return;
537
 
      }
538
 
   }
539
 
   printk(KERN_ERR "pci_set_drvdata issued for unknown device %p\n", pdev);
540
 
}
541
 
 
542
 
static inline void *
543
 
pci_get_drvdata(struct pci_dev *pdev)
544
 
{
545
 
   struct vmw_pci_driver_instance *pdi;
546
 
 
547
 
   for (pdi = pci_driver_instances; pdi; pdi = pdi->next) {
548
 
      if (pdi->pcidev == pdev) {
549
 
         return pdi->driver_data;
550
 
      }
551
 
   }
552
 
   printk(KERN_ERR "pci_get_drvdata issued for unknown device %p\n", pdev);
553
 
   return NULL;
554
 
}
555
 
#endif
556
 
 
557
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48)
558
 
#   define PCI_DMA_BIDIRECTIONAL        0
559
 
#   define PCI_DMA_TODEVICE             1
560
 
#   define PCI_DMA_FROMDEVICE           2
561
 
#   define PCI_DMA_NONE                 3
 
28
 
 
29
#ifndef DMA_BIT_MASK
 
30
#  define DMA_BIT_MASK(n) DMA_##n##BIT_MASK
562
31
#endif
563
32
 
564
33
/*
582
51
#endif
583
52
 
584
53
/* 2.6.14 changed the PCI shutdown callback */
585
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
 
54
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
586
55
#   define COMPAT_PCI_SHUTDOWN(func)               .driver = { .shutdown = (func), }
587
56
#   define COMPAT_PCI_DECLARE_SHUTDOWN(func, var)  (func)(struct device *(var))
588
57
#   define COMPAT_PCI_TO_DEV(dev)                  (to_pci_dev(dev))
593
62
#endif
594
63
 
595
64
/* 2.6.26 introduced the device_set_wakeup_enable() function */
596
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
597
 
#   define compat_device_set_wakeup_enable(dev, val) do{}while(0)
 
65
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
 
66
#   define compat_device_set_wakeup_enable(dev, val) do {} while(0)
598
67
#else
599
68
#   define compat_device_set_wakeup_enable(dev, val) \
600
69
       device_set_wakeup_enable(dev, val)