aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h68
-rw-r--r--include/drm/drm_crtc.h6
-rw-r--r--include/drm/drm_os_linux.h19
-rw-r--r--include/drm/drm_pciids.h113
-rw-r--r--include/drm/radeon_drm.h5
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/dma-debug.h174
-rw-r--r--include/linux/dma-mapping.h48
-rw-r--r--include/linux/dmar.h52
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/ftrace.h24
-rw-r--r--include/linux/i2c-id.h2
-rw-r--r--include/linux/ide.h239
-rw-r--r--include/linux/intel-iommu.h12
-rw-r--r--include/linux/interrupt.h9
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/ivtv.h10
-rw-r--r--include/linux/lockdep.h50
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/mutex.h5
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/pci_ids.h8
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/reiserfs_acl.h22
-rw-r--r--include/linux/reiserfs_fs.h168
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/reiserfs_fs_sb.h31
-rw-r--r--include/linux/reiserfs_xattr.h154
-rw-r--r--include/linux/sched.h3
-rw-r--r--include/linux/swiotlb.h41
-rw-r--r--include/linux/timer.h93
-rw-r--r--include/linux/video_decoder.h48
-rw-r--r--include/linux/video_encoder.h23
-rw-r--r--include/linux/videodev.h18
-rw-r--r--include/linux/videodev2.h69
-rw-r--r--include/media/bt819.h33
-rw-r--r--include/media/cx2341x.h6
-rw-r--r--include/media/cx25840.h12
-rw-r--r--include/media/ir-common.h3
-rw-r--r--include/media/ir-kbd-i2c.h3
-rw-r--r--include/media/ov772x.h5
-rw-r--r--include/media/saa7146.h8
-rw-r--r--include/media/saa7146_vv.h17
-rw-r--r--include/media/sh_mobile_ceu.h5
-rw-r--r--include/media/soc_camera.h24
-rw-r--r--include/media/v4l2-chip-ident.h94
-rw-r--r--include/media/v4l2-common.h24
-rw-r--r--include/media/v4l2-dev.h2
-rw-r--r--include/media/v4l2-device.h40
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-subdev.h22
-rw-r--r--include/media/videobuf-core.h1
-rw-r--r--include/sound/tea575x-tuner.h8
54 files changed, 1264 insertions, 578 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c19a93c3be85..c8c422151431 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -281,16 +281,16 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
281 281
282struct drm_ioctl_desc { 282struct drm_ioctl_desc {
283 unsigned int cmd; 283 unsigned int cmd;
284 drm_ioctl_t *func;
285 int flags; 284 int flags;
285 drm_ioctl_t *func;
286}; 286};
287 287
288/** 288/**
289 * Creates a driver or general drm_ioctl_desc array entry for the given 289 * Creates a driver or general drm_ioctl_desc array entry for the given
290 * ioctl, for use by drm_ioctl(). 290 * ioctl, for use by drm_ioctl().
291 */ 291 */
292#define DRM_IOCTL_DEF(ioctl, func, flags) \ 292#define DRM_IOCTL_DEF(ioctl, _func, _flags) \
293 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} 293 [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
294 294
295struct drm_magic_entry { 295struct drm_magic_entry {
296 struct list_head head; 296 struct list_head head;
@@ -523,19 +523,32 @@ struct drm_mm {
523 523
524 524
525/** 525/**
526 * Kernel side of a mapping
527 */
528struct drm_local_map {
529 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
530 unsigned long size; /**< Requested physical size (bytes) */
531 enum drm_map_type type; /**< Type of memory to map */
532 enum drm_map_flags flags; /**< Flags */
533 void *handle; /**< User-space: "Handle" to pass to mmap() */
534 /**< Kernel-space: kernel-virtual address */
535 int mtrr; /**< MTRR slot used */
536};
537
538typedef struct drm_local_map drm_local_map_t;
539
540/**
526 * Mappings list 541 * Mappings list
527 */ 542 */
528struct drm_map_list { 543struct drm_map_list {
529 struct list_head head; /**< list head */ 544 struct list_head head; /**< list head */
530 struct drm_hash_item hash; 545 struct drm_hash_item hash;
531 struct drm_map *map; /**< mapping */ 546 struct drm_local_map *map; /**< mapping */
532 uint64_t user_token; 547 uint64_t user_token;
533 struct drm_master *master; 548 struct drm_master *master;
534 struct drm_mm_node *file_offset_node; /**< fake offset */ 549 struct drm_mm_node *file_offset_node; /**< fake offset */
535}; 550};
536 551
537typedef struct drm_map drm_local_map_t;
538
539/** 552/**
540 * Context handle list 553 * Context handle list
541 */ 554 */
@@ -560,7 +573,7 @@ struct drm_ati_pcigart_info {
560 dma_addr_t bus_addr; 573 dma_addr_t bus_addr;
561 dma_addr_t table_mask; 574 dma_addr_t table_mask;
562 struct drm_dma_handle *table_handle; 575 struct drm_dma_handle *table_handle;
563 drm_local_map_t mapping; 576 struct drm_local_map mapping;
564 int table_size; 577 int table_size;
565}; 578};
566 579
@@ -675,7 +688,6 @@ struct drm_driver {
675 int (*kernel_context_switch) (struct drm_device *dev, int old, 688 int (*kernel_context_switch) (struct drm_device *dev, int old,
676 int new); 689 int new);
677 void (*kernel_context_switch_unlock) (struct drm_device *dev); 690 void (*kernel_context_switch_unlock) (struct drm_device *dev);
678 int (*dri_library_name) (struct drm_device *dev, char *buf);
679 691
680 /** 692 /**
681 * get_vblank_counter - get raw hardware vblank counter 693 * get_vblank_counter - get raw hardware vblank counter
@@ -747,8 +759,8 @@ struct drm_driver {
747 struct drm_file *file_priv); 759 struct drm_file *file_priv);
748 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 760 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
749 struct drm_file *file_priv); 761 struct drm_file *file_priv);
750 unsigned long (*get_map_ofs) (struct drm_map * map); 762 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
751 unsigned long (*get_reg_ofs) (struct drm_device *dev); 763 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
752 void (*set_version) (struct drm_device *dev, 764 void (*set_version) (struct drm_device *dev,
753 struct drm_set_version *sv); 765 struct drm_set_version *sv);
754 766
@@ -981,7 +993,7 @@ struct drm_device {
981 sigset_t sigmask; 993 sigset_t sigmask;
982 994
983 struct drm_driver *driver; 995 struct drm_driver *driver;
984 drm_local_map_t *agp_buffer_map; 996 struct drm_local_map *agp_buffer_map;
985 unsigned int agp_buffer_token; 997 unsigned int agp_buffer_token;
986 struct drm_minor *control; /**< Control node for card */ 998 struct drm_minor *control; /**< Control node for card */
987 struct drm_minor *primary; /**< render type primary screen head */ 999 struct drm_minor *primary; /**< render type primary screen head */
@@ -1098,8 +1110,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1098extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1110extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1099extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1111extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1100extern void drm_vm_open_locked(struct vm_area_struct *vma); 1112extern void drm_vm_open_locked(struct vm_area_struct *vma);
1101extern unsigned long drm_core_get_map_ofs(struct drm_map * map); 1113extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1102extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1114extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1103extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1115extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1104 1116
1105 /* Memory management support (drm_memory.h) */ 1117 /* Memory management support (drm_memory.h) */
@@ -1202,13 +1214,13 @@ extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv
1202 /* Buffer management support (drm_bufs.h) */ 1214 /* Buffer management support (drm_bufs.h) */
1203extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); 1215extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1204extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); 1216extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1205extern int drm_addmap(struct drm_device *dev, unsigned int offset, 1217extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1206 unsigned int size, enum drm_map_type type, 1218 unsigned int size, enum drm_map_type type,
1207 enum drm_map_flags flags, drm_local_map_t ** map_ptr); 1219 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1208extern int drm_addmap_ioctl(struct drm_device *dev, void *data, 1220extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
1209 struct drm_file *file_priv); 1221 struct drm_file *file_priv);
1210extern int drm_rmmap(struct drm_device *dev, drm_local_map_t *map); 1222extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
1211extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map); 1223extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
1212extern int drm_rmmap_ioctl(struct drm_device *dev, void *data, 1224extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
1213 struct drm_file *file_priv); 1225 struct drm_file *file_priv);
1214extern int drm_addbufs(struct drm_device *dev, void *data, 1226extern int drm_addbufs(struct drm_device *dev, void *data,
@@ -1222,10 +1234,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1222extern int drm_mapbufs(struct drm_device *dev, void *data, 1234extern int drm_mapbufs(struct drm_device *dev, void *data,
1223 struct drm_file *file_priv); 1235 struct drm_file *file_priv);
1224extern int drm_order(unsigned long size); 1236extern int drm_order(unsigned long size);
1225extern unsigned long drm_get_resource_start(struct drm_device *dev, 1237extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1238 unsigned int resource);
1239extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1226 unsigned int resource); 1240 unsigned int resource);
1227extern unsigned long drm_get_resource_len(struct drm_device *dev,
1228 unsigned int resource);
1229 1241
1230 /* DMA support (drm_dma.h) */ 1242 /* DMA support (drm_dma.h) */
1231extern int drm_dma_setup(struct drm_device *dev); 1243extern int drm_dma_setup(struct drm_device *dev);
@@ -1301,7 +1313,7 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1301extern void drm_master_put(struct drm_master **master); 1313extern void drm_master_put(struct drm_master **master);
1302extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1314extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1303 struct drm_driver *driver); 1315 struct drm_driver *driver);
1304extern int drm_put_dev(struct drm_device *dev); 1316extern void drm_put_dev(struct drm_device *dev);
1305extern int drm_put_minor(struct drm_minor **minor); 1317extern int drm_put_minor(struct drm_minor **minor);
1306extern unsigned int drm_debug; 1318extern unsigned int drm_debug;
1307 1319
@@ -1311,7 +1323,7 @@ extern struct dentry *drm_debugfs_root;
1311 1323
1312extern struct idr drm_minors_idr; 1324extern struct idr drm_minors_idr;
1313 1325
1314extern drm_local_map_t *drm_getsarea(struct drm_device *dev); 1326extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1315 1327
1316 /* Proc support (drm_proc.h) */ 1328 /* Proc support (drm_proc.h) */
1317extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1329extern int drm_proc_init(struct drm_minor *minor, int minor_id,
@@ -1453,12 +1465,12 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1453void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); 1465void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1454void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); 1466void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1455 1467
1456extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1468extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1457extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1469extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1458extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1470extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1459 1471
1460static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, 1472static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1461 unsigned int token) 1473 unsigned int token)
1462{ 1474{
1463 struct drm_map_list *_entry; 1475 struct drm_map_list *_entry;
1464 list_for_each_entry(_entry, &dev->maplist, head) 1476 list_for_each_entry(_entry, &dev->maplist, head)
@@ -1485,7 +1497,7 @@ static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1485 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1497 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1486} 1498}
1487 1499
1488static __inline__ void drm_core_dropmap(struct drm_map *map) 1500static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1489{ 1501{
1490} 1502}
1491 1503
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5ded1acfb543..3c1924c010e8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -550,7 +550,7 @@ struct drm_mode_config {
550 int min_width, min_height; 550 int min_width, min_height;
551 int max_width, max_height; 551 int max_width, max_height;
552 struct drm_mode_config_funcs *funcs; 552 struct drm_mode_config_funcs *funcs;
553 unsigned long fb_base; 553 resource_size_t fb_base;
554 554
555 /* pointers to standard properties */ 555 /* pointers to standard properties */
556 struct list_head property_blob_list; 556 struct list_head property_blob_list;
@@ -613,7 +613,8 @@ extern void drm_fb_release(struct drm_file *file_priv);
613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
614extern struct edid *drm_get_edid(struct drm_connector *connector, 614extern struct edid *drm_get_edid(struct drm_connector *connector,
615 struct i2c_adapter *adapter); 615 struct i2c_adapter *adapter);
616extern unsigned char *drm_do_probe_ddc_edid(struct i2c_adapter *adapter); 616extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
617 unsigned char *buf, int len);
617extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 618extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
618extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 619extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
619extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 620extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -731,4 +732,5 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
731 void *data, struct drm_file *file_priv); 732 void *data, struct drm_file *file_priv);
732extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 733extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
733 void *data, struct drm_file *file_priv); 734 void *data, struct drm_file *file_priv);
735extern bool drm_detect_hdmi_monitor(struct edid *edid);
734#endif /* __DRM_CRTC_H__ */ 736#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 8dbd2572b7c3..013551d03c03 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -6,6 +6,19 @@
6#include <linux/interrupt.h> /* For task queue support */ 6#include <linux/interrupt.h> /* For task queue support */
7#include <linux/delay.h> 7#include <linux/delay.h>
8 8
9#ifndef readq
10static u64 readq(void __iomem *reg)
11{
12 return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
13}
14
15static void writeq(u64 val, void __iomem *reg)
16{
17 writel(val & 0xffffffff, reg);
18 writel(val >> 32, reg + 0x4UL);
19}
20#endif
21
9/** Current process ID */ 22/** Current process ID */
10#define DRM_CURRENTPID task_pid_nr(current) 23#define DRM_CURRENTPID task_pid_nr(current)
11#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) 24#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
@@ -23,6 +36,12 @@
23/** Write a dword into a MMIO region */ 36/** Write a dword into a MMIO region */
24#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) 37#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset))
25/** Read memory barrier */ 38/** Read memory barrier */
39
40/** Read a qword from a MMIO region - be careful using these unless you really understand them */
41#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset))
42/** Write a qword into a MMIO region */
43#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset))
44
26#define DRM_READMEMORYBARRIER() rmb() 45#define DRM_READMEMORYBARRIER() rmb()
27/** Write memory barrier */ 46/** Write memory barrier */
28#define DRM_WRITEMEMORYBARRIER() wmb() 47#define DRM_WRITEMEMORYBARRIER() wmb()
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 76c4c8243038..2df74eb09563 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -239,10 +239,123 @@
239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
242 {0x1002, 0x793f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
243 {0x1002, 0x7941, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
244 {0x1002, 0x7942, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
242 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 245 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
243 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 246 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
244 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 247 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
245 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 248 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
249 {0x1002, 0x9400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
250 {0x1002, 0x9401, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
251 {0x1002, 0x9402, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
252 {0x1002, 0x9403, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
253 {0x1002, 0x9405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x9444, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x9446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
262 {0x1002, 0x944A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
263 {0x1002, 0x944B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
264 {0x1002, 0x944C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
265 {0x1002, 0x944E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
266 {0x1002, 0x9450, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
267 {0x1002, 0x9452, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
268 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
269 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
270 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
271 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
272 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
273 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x947B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x9480, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
278 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
279 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
280 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
281 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
282 {0x1002, 0x9498, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
283 {0x1002, 0x949C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
284 {0x1002, 0x949E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
285 {0x1002, 0x949F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
286 {0x1002, 0x94C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
287 {0x1002, 0x94C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
288 {0x1002, 0x94C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
289 {0x1002, 0x94C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
290 {0x1002, 0x94C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
291 {0x1002, 0x94C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
292 {0x1002, 0x94C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
293 {0x1002, 0x94C8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
294 {0x1002, 0x94C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
295 {0x1002, 0x94CB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
296 {0x1002, 0x94CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
297 {0x1002, 0x94CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
298 {0x1002, 0x9500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
299 {0x1002, 0x9501, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
300 {0x1002, 0x9504, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
301 {0x1002, 0x9505, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
302 {0x1002, 0x9506, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
303 {0x1002, 0x9507, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
304 {0x1002, 0x9508, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
305 {0x1002, 0x9509, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
306 {0x1002, 0x950F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
307 {0x1002, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
308 {0x1002, 0x9515, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
309 {0x1002, 0x9517, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
310 {0x1002, 0x9519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
311 {0x1002, 0x9540, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
312 {0x1002, 0x9541, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
313 {0x1002, 0x9542, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
314 {0x1002, 0x954E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
315 {0x1002, 0x954F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
316 {0x1002, 0x9552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
317 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
318 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
319 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
320 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
321 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
322 {0x1002, 0x9586, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
323 {0x1002, 0x9587, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
324 {0x1002, 0x9588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
325 {0x1002, 0x9589, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
326 {0x1002, 0x958A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
327 {0x1002, 0x958B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
328 {0x1002, 0x958C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
329 {0x1002, 0x958D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
330 {0x1002, 0x958E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
331 {0x1002, 0x958F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
332 {0x1002, 0x9590, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
333 {0x1002, 0x9591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
334 {0x1002, 0x9593, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
335 {0x1002, 0x9595, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
336 {0x1002, 0x9596, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
337 {0x1002, 0x9597, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
338 {0x1002, 0x9598, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
339 {0x1002, 0x9599, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
340 {0x1002, 0x959B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
341 {0x1002, 0x95C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
342 {0x1002, 0x95C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
343 {0x1002, 0x95C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
344 {0x1002, 0x95C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
345 {0x1002, 0x95C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
346 {0x1002, 0x95C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
347 {0x1002, 0x95C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
348 {0x1002, 0x95CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
349 {0x1002, 0x95CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
350 {0x1002, 0x95CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
351 {0x1002, 0x95CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
352 {0x1002, 0x9610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
353 {0x1002, 0x9611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
354 {0x1002, 0x9612, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
355 {0x1002, 0x9613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
356 {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
357 {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
358 {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
246 {0, 0, 0} 359 {0, 0, 0}
247 360
248#define r128_PCI_IDS \ 361#define r128_PCI_IDS \
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 72ecf67ad3ec..fe3e3a4b4aed 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -306,6 +306,8 @@ typedef union {
306 306
307#define RADEON_SCRATCH_REG_OFFSET 32 307#define RADEON_SCRATCH_REG_OFFSET 32
308 308
309#define R600_SCRATCH_REG_OFFSET 256
310
309#define RADEON_NR_SAREA_CLIPRECTS 12 311#define RADEON_NR_SAREA_CLIPRECTS 12
310 312
311/* There are 2 heaps (local/GART). Each region within a heap is a 313/* There are 2 heaps (local/GART). Each region within a heap is a
@@ -528,7 +530,8 @@ typedef struct drm_radeon_init {
528 RADEON_INIT_CP = 0x01, 530 RADEON_INIT_CP = 0x01,
529 RADEON_CLEANUP_CP = 0x02, 531 RADEON_CLEANUP_CP = 0x02,
530 RADEON_INIT_R200_CP = 0x03, 532 RADEON_INIT_R200_CP = 0x03,
531 RADEON_INIT_R300_CP = 0x04 533 RADEON_INIT_R300_CP = 0x04,
534 RADEON_INIT_R600_CP = 0x05
532 } func; 535 } func;
533 unsigned long sarea_priv_offset; 536 unsigned long sarea_priv_offset;
534 int is_pci; 537 int is_pci;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e9581fd9fb66..a67b6227d272 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -158,8 +158,6 @@ header-y += ultrasound.h
158header-y += un.h 158header-y += un.h
159header-y += utime.h 159header-y += utime.h
160header-y += veth.h 160header-y += veth.h
161header-y += video_decoder.h
162header-y += video_encoder.h
163header-y += videotext.h 161header-y += videotext.h
164header-y += x25.h 162header-y += x25.h
165 163
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
new file mode 100644
index 000000000000..28d53cb7b5a2
--- /dev/null
+++ b/include/linux/dma-debug.h
@@ -0,0 +1,174 @@
1/*
2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
3 *
4 * Author: Joerg Roedel <joerg.roedel@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __DMA_DEBUG_H
21#define __DMA_DEBUG_H
22
23#include <linux/types.h>
24
25struct device;
26struct scatterlist;
27struct bus_type;
28
29#ifdef CONFIG_DMA_API_DEBUG
30
31extern void dma_debug_add_bus(struct bus_type *bus);
32
33extern void dma_debug_init(u32 num_entries);
34
35extern void debug_dma_map_page(struct device *dev, struct page *page,
36 size_t offset, size_t size,
37 int direction, dma_addr_t dma_addr,
38 bool map_single);
39
40extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
41 size_t size, int direction, bool map_single);
42
43extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
44 int nents, int mapped_ents, int direction);
45
46extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
47 int nelems, int dir);
48
49extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
50 dma_addr_t dma_addr, void *virt);
51
52extern void debug_dma_free_coherent(struct device *dev, size_t size,
53 void *virt, dma_addr_t addr);
54
55extern void debug_dma_sync_single_for_cpu(struct device *dev,
56 dma_addr_t dma_handle, size_t size,
57 int direction);
58
59extern void debug_dma_sync_single_for_device(struct device *dev,
60 dma_addr_t dma_handle,
61 size_t size, int direction);
62
63extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
64 dma_addr_t dma_handle,
65 unsigned long offset,
66 size_t size,
67 int direction);
68
69extern void debug_dma_sync_single_range_for_device(struct device *dev,
70 dma_addr_t dma_handle,
71 unsigned long offset,
72 size_t size, int direction);
73
74extern void debug_dma_sync_sg_for_cpu(struct device *dev,
75 struct scatterlist *sg,
76 int nelems, int direction);
77
78extern void debug_dma_sync_sg_for_device(struct device *dev,
79 struct scatterlist *sg,
80 int nelems, int direction);
81
82extern void debug_dma_dump_mappings(struct device *dev);
83
84#else /* CONFIG_DMA_API_DEBUG */
85
86static inline void dma_debug_add_bus(struct bus_type *bus)
87{
88}
89
90static inline void dma_debug_init(u32 num_entries)
91{
92}
93
94static inline void debug_dma_map_page(struct device *dev, struct page *page,
95 size_t offset, size_t size,
96 int direction, dma_addr_t dma_addr,
97 bool map_single)
98{
99}
100
101static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
102 size_t size, int direction,
103 bool map_single)
104{
105}
106
107static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
108 int nents, int mapped_ents, int direction)
109{
110}
111
112static inline void debug_dma_unmap_sg(struct device *dev,
113 struct scatterlist *sglist,
114 int nelems, int dir)
115{
116}
117
118static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
119 dma_addr_t dma_addr, void *virt)
120{
121}
122
123static inline void debug_dma_free_coherent(struct device *dev, size_t size,
124 void *virt, dma_addr_t addr)
125{
126}
127
128static inline void debug_dma_sync_single_for_cpu(struct device *dev,
129 dma_addr_t dma_handle,
130 size_t size, int direction)
131{
132}
133
134static inline void debug_dma_sync_single_for_device(struct device *dev,
135 dma_addr_t dma_handle,
136 size_t size, int direction)
137{
138}
139
140static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
141 dma_addr_t dma_handle,
142 unsigned long offset,
143 size_t size,
144 int direction)
145{
146}
147
148static inline void debug_dma_sync_single_range_for_device(struct device *dev,
149 dma_addr_t dma_handle,
150 unsigned long offset,
151 size_t size,
152 int direction)
153{
154}
155
156static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
157 struct scatterlist *sg,
158 int nelems, int direction)
159{
160}
161
162static inline void debug_dma_sync_sg_for_device(struct device *dev,
163 struct scatterlist *sg,
164 int nelems, int direction)
165{
166}
167
168static inline void debug_dma_dump_mappings(struct device *dev)
169{
170}
171
172#endif /* CONFIG_DMA_API_DEBUG */
173
174#endif /* __DMA_DEBUG_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ba9114ec5d3a..d7d090d21031 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/dma-attrs.h>
7#include <linux/scatterlist.h>
6 8
7/* These definitions mirror those in pci.h, so they can be used 9/* These definitions mirror those in pci.h, so they can be used
8 * interchangeably with their PCI_ counterparts */ 10 * interchangeably with their PCI_ counterparts */
@@ -13,6 +15,52 @@ enum dma_data_direction {
13 DMA_NONE = 3, 15 DMA_NONE = 3,
14}; 16};
15 17
18struct dma_map_ops {
19 void* (*alloc_coherent)(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, gfp_t gfp);
21 void (*free_coherent)(struct device *dev, size_t size,
22 void *vaddr, dma_addr_t dma_handle);
23 dma_addr_t (*map_page)(struct device *dev, struct page *page,
24 unsigned long offset, size_t size,
25 enum dma_data_direction dir,
26 struct dma_attrs *attrs);
27 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
28 size_t size, enum dma_data_direction dir,
29 struct dma_attrs *attrs);
30 int (*map_sg)(struct device *dev, struct scatterlist *sg,
31 int nents, enum dma_data_direction dir,
32 struct dma_attrs *attrs);
33 void (*unmap_sg)(struct device *dev,
34 struct scatterlist *sg, int nents,
35 enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37 void (*sync_single_for_cpu)(struct device *dev,
38 dma_addr_t dma_handle, size_t size,
39 enum dma_data_direction dir);
40 void (*sync_single_for_device)(struct device *dev,
41 dma_addr_t dma_handle, size_t size,
42 enum dma_data_direction dir);
43 void (*sync_single_range_for_cpu)(struct device *dev,
44 dma_addr_t dma_handle,
45 unsigned long offset,
46 size_t size,
47 enum dma_data_direction dir);
48 void (*sync_single_range_for_device)(struct device *dev,
49 dma_addr_t dma_handle,
50 unsigned long offset,
51 size_t size,
52 enum dma_data_direction dir);
53 void (*sync_sg_for_cpu)(struct device *dev,
54 struct scatterlist *sg, int nents,
55 enum dma_data_direction dir);
56 void (*sync_sg_for_device)(struct device *dev,
57 struct scatterlist *sg, int nents,
58 enum dma_data_direction dir);
59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
60 int (*dma_supported)(struct device *dev, u64 mask);
61 int is_phys;
62};
63
16#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 64#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
17 65
18/* 66/*
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f28440784cf0..2f3427468956 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -24,10 +24,10 @@
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h>
27 28
28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
31struct dmar_drhd_unit { 31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */ 32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */ 33 struct acpi_dmar_header *hdr; /* ACPI header */
@@ -49,7 +49,7 @@ extern int dmar_dev_scope_init(void);
49 49
50/* Intel IOMMU detection */ 50/* Intel IOMMU detection */
51extern void detect_intel_iommu(void); 51extern void detect_intel_iommu(void);
52 52extern int enable_drhd_fault_handling(void);
53 53
54extern int parse_ioapics_under_ir(void); 54extern int parse_ioapics_under_ir(void);
55extern int alloc_iommu(struct dmar_drhd_unit *); 55extern int alloc_iommu(struct dmar_drhd_unit *);
@@ -63,12 +63,12 @@ static inline int dmar_table_init(void)
63{ 63{
64 return -ENODEV; 64 return -ENODEV;
65} 65}
66static inline int enable_drhd_fault_handling(void)
67{
68 return -1;
69}
66#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ 70#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
67 71
68#ifdef CONFIG_INTR_REMAP
69extern int intr_remapping_enabled;
70extern int enable_intr_remapping(int);
71
72struct irte { 72struct irte {
73 union { 73 union {
74 struct { 74 struct {
@@ -97,6 +97,10 @@ struct irte {
97 __u64 high; 97 __u64 high;
98 }; 98 };
99}; 99};
100#ifdef CONFIG_INTR_REMAP
101extern int intr_remapping_enabled;
102extern int enable_intr_remapping(int);
103
100extern int get_irte(int irq, struct irte *entry); 104extern int get_irte(int irq, struct irte *entry);
101extern int modify_irte(int irq, struct irte *irte_modified); 105extern int modify_irte(int irq, struct irte *irte_modified);
102extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); 106extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
@@ -111,14 +115,40 @@ extern int irq_remapped(int irq);
111extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 115extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
112extern struct intel_iommu *map_ioapic_to_ir(int apic); 116extern struct intel_iommu *map_ioapic_to_ir(int apic);
113#else 117#else
118static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
119{
120 return -1;
121}
122static inline int modify_irte(int irq, struct irte *irte_modified)
123{
124 return -1;
125}
126static inline int free_irte(int irq)
127{
128 return -1;
129}
130static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
131{
132 return -1;
133}
134static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
135 u16 sub_handle)
136{
137 return -1;
138}
139static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
140{
141 return NULL;
142}
143static inline struct intel_iommu *map_ioapic_to_ir(int apic)
144{
145 return NULL;
146}
114#define irq_remapped(irq) (0) 147#define irq_remapped(irq) (0)
115#define enable_intr_remapping(mode) (-1) 148#define enable_intr_remapping(mode) (-1)
116#define intr_remapping_enabled (0) 149#define intr_remapping_enabled (0)
117#endif 150#endif
118 151
119#ifdef CONFIG_DMAR
120extern const char *dmar_get_fault_reason(u8 fault_reason);
121
122/* Can't use the common MSI interrupt functions 152/* Can't use the common MSI interrupt functions
123 * since DMAR is not a pci device 153 * since DMAR is not a pci device
124 */ 154 */
@@ -127,8 +157,10 @@ extern void dmar_msi_mask(unsigned int irq);
127extern void dmar_msi_read(int irq, struct msi_msg *msg); 157extern void dmar_msi_read(int irq, struct msi_msg *msg);
128extern void dmar_msi_write(int irq, struct msi_msg *msg); 158extern void dmar_msi_write(int irq, struct msi_msg *msg);
129extern int dmar_set_interrupt(struct intel_iommu *iommu); 159extern int dmar_set_interrupt(struct intel_iommu *iommu);
160extern irqreturn_t dmar_fault(int irq, void *dev_id);
130extern int arch_setup_dmar_msi(unsigned int irq); 161extern int arch_setup_dmar_msi(unsigned int irq);
131 162
163#ifdef CONFIG_DMAR
132extern int iommu_detected, no_iommu; 164extern int iommu_detected, no_iommu;
133extern struct list_head dmar_rmrr_units; 165extern struct list_head dmar_rmrr_units;
134struct dmar_rmrr_unit { 166struct dmar_rmrr_unit {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 42436ae42f70..87e7bfc5ebd7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -849,7 +849,7 @@ struct file {
849#define f_dentry f_path.dentry 849#define f_dentry f_path.dentry
850#define f_vfsmnt f_path.mnt 850#define f_vfsmnt f_path.mnt
851 const struct file_operations *f_op; 851 const struct file_operations *f_op;
852 spinlock_t f_lock; /* f_ep_links, f_flags */ 852 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
853 atomic_long_t f_count; 853 atomic_long_t f_count;
854 unsigned int f_flags; 854 unsigned int f_flags;
855 fmode_t f_mode; 855 fmode_t f_mode;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 677432b9cb7e..a7f8134c594e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -380,6 +380,30 @@ struct ftrace_graph_ret {
380#ifdef CONFIG_FUNCTION_GRAPH_TRACER 380#ifdef CONFIG_FUNCTION_GRAPH_TRACER
381 381
382/* 382/*
383 * Stack of return addresses for functions
384 * of a thread.
385 * Used in struct thread_info
386 */
387struct ftrace_ret_stack {
388 unsigned long ret;
389 unsigned long func;
390 unsigned long long calltime;
391};
392
393/*
394 * Primary handler of a function return.
395 * It relays on ftrace_return_to_handler.
396 * Defined in entry_32/64.S
397 */
398extern void return_to_handler(void);
399
400extern int
401ftrace_push_return_trace(unsigned long ret, unsigned long long time,
402 unsigned long func, int *depth);
403extern void
404ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
405
406/*
383 * Sometimes we don't want to trace a function with the function 407 * Sometimes we don't want to trace a function with the function
384 * graph tracer but we want them to keep traced by the usual function 408 * graph tracer but we want them to keep traced by the usual function
385 * tracer if the function graph tracer is not configured. 409 * tracer if the function graph tracer is not configured.
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 1ffc23bc5d1e..f27604af8378 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -71,6 +71,7 @@
71#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ 71#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
72#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ 72#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
73#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ 73#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
74#define I2C_DRIVERID_AU8522 97 /* Auvitek au8522 */
74 75
75#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ 76#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
76 77
@@ -87,6 +88,7 @@
87#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 88#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
88#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 89#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
89#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */ 90#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
91#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
90 92
91/* --- SGI adapters */ 93/* --- SGI adapters */
92#define I2C_HW_SGI_VINO 0x160000 94#define I2C_HW_SGI_VINO 0x160000
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 854eba8b2ba3..d5d832271f44 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -40,6 +40,13 @@
40#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
42 42
43/* Error codes returned in rq->errors to the higher part of the driver. */
44enum {
45 IDE_DRV_ERROR_GENERAL = 101,
46 IDE_DRV_ERROR_FILEMARK = 102,
47 IDE_DRV_ERROR_EOD = 103,
48};
49
43/* 50/*
44 * Definitions for accessing IDE controller registers 51 * Definitions for accessing IDE controller registers
45 */ 52 */
@@ -193,26 +200,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
193 hw->io_ports.ctl_addr = ctl_addr; 200 hw->io_ports.ctl_addr = ctl_addr;
194} 201}
195 202
196#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
197 defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
198#include <asm/ide.h>
199#else
200#include <asm-generic/ide_iops.h>
201#endif
202
203#define MAX_HWIFS 10 203#define MAX_HWIFS 10
204 204
205/* Currently only m68k, apus and m8xx need it */
206#ifndef IDE_ARCH_ACK_INTR
207# define ide_ack_intr(hwif) (1)
208#endif
209
210/* Currently only Atari needs it */
211#ifndef IDE_ARCH_LOCK
212# define ide_release_lock() do {} while (0)
213# define ide_get_lock(hdlr, data) do {} while (0)
214#endif /* IDE_ARCH_LOCK */
215
216/* 205/*
217 * Now for the data we need to maintain per-drive: ide_drive_t 206 * Now for the data we need to maintain per-drive: ide_drive_t
218 */ 207 */
@@ -252,56 +241,52 @@ typedef enum {
252 241
253enum { 242enum {
254 IDE_TFLAG_LBA48 = (1 << 0), 243 IDE_TFLAG_LBA48 = (1 << 0),
255 IDE_TFLAG_FLAGGED = (1 << 2), 244 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1),
256 IDE_TFLAG_OUT_DATA = (1 << 3), 245 IDE_TFLAG_OUT_HOB_NSECT = (1 << 2),
257 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 246 IDE_TFLAG_OUT_HOB_LBAL = (1 << 3),
258 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), 247 IDE_TFLAG_OUT_HOB_LBAM = (1 << 4),
259 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), 248 IDE_TFLAG_OUT_HOB_LBAH = (1 << 5),
260 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
261 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
262 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | 249 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
263 IDE_TFLAG_OUT_HOB_NSECT | 250 IDE_TFLAG_OUT_HOB_NSECT |
264 IDE_TFLAG_OUT_HOB_LBAL | 251 IDE_TFLAG_OUT_HOB_LBAL |
265 IDE_TFLAG_OUT_HOB_LBAM | 252 IDE_TFLAG_OUT_HOB_LBAM |
266 IDE_TFLAG_OUT_HOB_LBAH, 253 IDE_TFLAG_OUT_HOB_LBAH,
267 IDE_TFLAG_OUT_FEATURE = (1 << 9), 254 IDE_TFLAG_OUT_FEATURE = (1 << 6),
268 IDE_TFLAG_OUT_NSECT = (1 << 10), 255 IDE_TFLAG_OUT_NSECT = (1 << 7),
269 IDE_TFLAG_OUT_LBAL = (1 << 11), 256 IDE_TFLAG_OUT_LBAL = (1 << 8),
270 IDE_TFLAG_OUT_LBAM = (1 << 12), 257 IDE_TFLAG_OUT_LBAM = (1 << 9),
271 IDE_TFLAG_OUT_LBAH = (1 << 13), 258 IDE_TFLAG_OUT_LBAH = (1 << 10),
272 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | 259 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
273 IDE_TFLAG_OUT_NSECT | 260 IDE_TFLAG_OUT_NSECT |
274 IDE_TFLAG_OUT_LBAL | 261 IDE_TFLAG_OUT_LBAL |
275 IDE_TFLAG_OUT_LBAM | 262 IDE_TFLAG_OUT_LBAM |
276 IDE_TFLAG_OUT_LBAH, 263 IDE_TFLAG_OUT_LBAH,
277 IDE_TFLAG_OUT_DEVICE = (1 << 14), 264 IDE_TFLAG_OUT_DEVICE = (1 << 11),
278 IDE_TFLAG_WRITE = (1 << 15), 265 IDE_TFLAG_WRITE = (1 << 12),
279 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), 266 IDE_TFLAG_CUSTOM_HANDLER = (1 << 13),
280 IDE_TFLAG_IN_DATA = (1 << 17), 267 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14),
281 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), 268 IDE_TFLAG_IN_HOB_FEATURE = (1 << 15),
282 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), 269 IDE_TFLAG_IN_HOB_NSECT = (1 << 16),
283 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), 270 IDE_TFLAG_IN_HOB_LBAL = (1 << 17),
284 IDE_TFLAG_IN_HOB_NSECT = (1 << 21), 271 IDE_TFLAG_IN_HOB_LBAM = (1 << 18),
285 IDE_TFLAG_IN_HOB_LBAL = (1 << 22), 272 IDE_TFLAG_IN_HOB_LBAH = (1 << 19),
286 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
287 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
288 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | 273 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
289 IDE_TFLAG_IN_HOB_LBAM | 274 IDE_TFLAG_IN_HOB_LBAM |
290 IDE_TFLAG_IN_HOB_LBAH, 275 IDE_TFLAG_IN_HOB_LBAH,
291 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | 276 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
292 IDE_TFLAG_IN_HOB_NSECT | 277 IDE_TFLAG_IN_HOB_NSECT |
293 IDE_TFLAG_IN_HOB_LBA, 278 IDE_TFLAG_IN_HOB_LBA,
294 IDE_TFLAG_IN_FEATURE = (1 << 1), 279 IDE_TFLAG_IN_FEATURE = (1 << 20),
295 IDE_TFLAG_IN_NSECT = (1 << 25), 280 IDE_TFLAG_IN_NSECT = (1 << 21),
296 IDE_TFLAG_IN_LBAL = (1 << 26), 281 IDE_TFLAG_IN_LBAL = (1 << 22),
297 IDE_TFLAG_IN_LBAM = (1 << 27), 282 IDE_TFLAG_IN_LBAM = (1 << 23),
298 IDE_TFLAG_IN_LBAH = (1 << 28), 283 IDE_TFLAG_IN_LBAH = (1 << 24),
299 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | 284 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
300 IDE_TFLAG_IN_LBAM | 285 IDE_TFLAG_IN_LBAM |
301 IDE_TFLAG_IN_LBAH, 286 IDE_TFLAG_IN_LBAH,
302 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | 287 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
303 IDE_TFLAG_IN_LBA, 288 IDE_TFLAG_IN_LBA,
304 IDE_TFLAG_IN_DEVICE = (1 << 29), 289 IDE_TFLAG_IN_DEVICE = (1 << 25),
305 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | 290 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
306 IDE_TFLAG_IN_HOB, 291 IDE_TFLAG_IN_HOB,
307 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | 292 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
@@ -309,9 +294,18 @@ enum {
309 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | 294 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
310 IDE_TFLAG_IN_DEVICE, 295 IDE_TFLAG_IN_DEVICE,
311 /* force 16-bit I/O operations */ 296 /* force 16-bit I/O operations */
312 IDE_TFLAG_IO_16BIT = (1 << 30), 297 IDE_TFLAG_IO_16BIT = (1 << 26),
313 /* ide_task_t was allocated using kmalloc() */ 298 /* struct ide_cmd was allocated using kmalloc() */
314 IDE_TFLAG_DYN = (1 << 31), 299 IDE_TFLAG_DYN = (1 << 27),
300 IDE_TFLAG_FS = (1 << 28),
301 IDE_TFLAG_MULTI_PIO = (1 << 29),
302};
303
304enum {
305 IDE_FTFLAG_FLAGGED = (1 << 0),
306 IDE_FTFLAG_SET_IN_FLAGS = (1 << 1),
307 IDE_FTFLAG_OUT_DATA = (1 << 2),
308 IDE_FTFLAG_IN_DATA = (1 << 3),
315}; 309};
316 310
317struct ide_taskfile { 311struct ide_taskfile {
@@ -343,16 +337,27 @@ struct ide_taskfile {
343 }; 337 };
344}; 338};
345 339
346typedef struct ide_task_s { 340struct ide_cmd {
347 union { 341 union {
348 struct ide_taskfile tf; 342 struct ide_taskfile tf;
349 u8 tf_array[14]; 343 u8 tf_array[14];
350 }; 344 };
345 u8 ftf_flags; /* for TASKFILE ioctl */
351 u32 tf_flags; 346 u32 tf_flags;
352 int data_phase; 347 int protocol;
348
349 int sg_nents; /* number of sg entries */
350 int orig_sg_nents;
351 int sg_dma_direction; /* DMA transfer direction */
352
353 unsigned int nbytes;
354 unsigned int nleft;
355 struct scatterlist *cursg;
356 unsigned int cursg_ofs;
357
353 struct request *rq; /* copy of request */ 358 struct request *rq; /* copy of request */
354 void *special; /* valid_t generally */ 359 void *special; /* valid_t generally */
355} ide_task_t; 360};
356 361
357/* ATAPI packet command flags */ 362/* ATAPI packet command flags */
358enum { 363enum {
@@ -364,8 +369,6 @@ enum {
364 PC_FLAG_DMA_IN_PROGRESS = (1 << 4), 369 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
365 PC_FLAG_DMA_ERROR = (1 << 5), 370 PC_FLAG_DMA_ERROR = (1 << 5),
366 PC_FLAG_WRITING = (1 << 6), 371 PC_FLAG_WRITING = (1 << 6),
367 /* command timed out */
368 PC_FLAG_TIMEDOUT = (1 << 7),
369}; 372};
370 373
371/* 374/*
@@ -436,7 +439,6 @@ struct ide_disk_ops {
436 int); 439 int);
437 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, 440 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
438 sector_t); 441 sector_t);
439 int (*end_request)(struct ide_drive_s *, int, int);
440 int (*ioctl)(struct ide_drive_s *, struct block_device *, 442 int (*ioctl)(struct ide_drive_s *, struct block_device *,
441 fmode_t, unsigned int, unsigned long); 443 fmode_t, unsigned int, unsigned long);
442}; 444};
@@ -512,8 +514,6 @@ enum {
512 IDE_DFLAG_NICE1 = (1 << 5), 514 IDE_DFLAG_NICE1 = (1 << 5),
513 /* device is physically present */ 515 /* device is physically present */
514 IDE_DFLAG_PRESENT = (1 << 6), 516 IDE_DFLAG_PRESENT = (1 << 6),
515 /* device ejected hint */
516 IDE_DFLAG_DEAD = (1 << 7),
517 /* id read from device (synthetic if not set) */ 517 /* id read from device (synthetic if not set) */
518 IDE_DFLAG_ID_READ = (1 << 8), 518 IDE_DFLAG_ID_READ = (1 << 8),
519 IDE_DFLAG_NOPROBE = (1 << 9), 519 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -627,8 +627,11 @@ struct ide_drive_s {
627 /* current packet command */ 627 /* current packet command */
628 struct ide_atapi_pc *pc; 628 struct ide_atapi_pc *pc;
629 629
630 /* last failed packet command */
631 struct ide_atapi_pc *failed_pc;
632
630 /* callback for packet commands */ 633 /* callback for packet commands */
631 void (*pc_callback)(struct ide_drive_s *, int); 634 int (*pc_callback)(struct ide_drive_s *, int);
632 635
633 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); 636 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
634 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 637 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
@@ -661,13 +664,13 @@ struct ide_tp_ops {
661 664
662 void (*set_irq)(struct hwif_s *, int); 665 void (*set_irq)(struct hwif_s *, int);
663 666
664 void (*tf_load)(ide_drive_t *, struct ide_task_s *); 667 void (*tf_load)(ide_drive_t *, struct ide_cmd *);
665 void (*tf_read)(ide_drive_t *, struct ide_task_s *); 668 void (*tf_read)(ide_drive_t *, struct ide_cmd *);
666 669
667 void (*input_data)(ide_drive_t *, struct request *, void *, 670 void (*input_data)(ide_drive_t *, struct ide_cmd *,
668 unsigned int); 671 void *, unsigned int);
669 void (*output_data)(ide_drive_t *, struct request *, void *, 672 void (*output_data)(ide_drive_t *, struct ide_cmd *,
670 unsigned int); 673 void *, unsigned int);
671}; 674};
672 675
673extern const struct ide_tp_ops default_tp_ops; 676extern const struct ide_tp_ops default_tp_ops;
@@ -711,12 +714,12 @@ struct ide_port_ops {
711 714
712struct ide_dma_ops { 715struct ide_dma_ops {
713 void (*dma_host_set)(struct ide_drive_s *, int); 716 void (*dma_host_set)(struct ide_drive_s *, int);
714 int (*dma_setup)(struct ide_drive_s *); 717 int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *);
715 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
716 void (*dma_start)(struct ide_drive_s *); 718 void (*dma_start)(struct ide_drive_s *);
717 int (*dma_end)(struct ide_drive_s *); 719 int (*dma_end)(struct ide_drive_s *);
718 int (*dma_test_irq)(struct ide_drive_s *); 720 int (*dma_test_irq)(struct ide_drive_s *);
719 void (*dma_lost_irq)(struct ide_drive_s *); 721 void (*dma_lost_irq)(struct ide_drive_s *);
722 int (*dma_timer_expiry)(struct ide_drive_s *);
720 void (*dma_timeout)(struct ide_drive_s *); 723 void (*dma_timeout)(struct ide_drive_s *);
721 /* 724 /*
722 * The following method is optional and only required to be 725 * The following method is optional and only required to be
@@ -780,19 +783,8 @@ typedef struct hwif_s {
780 /* Scatter-gather list used to build the above */ 783 /* Scatter-gather list used to build the above */
781 struct scatterlist *sg_table; 784 struct scatterlist *sg_table;
782 int sg_max_nents; /* Maximum number of entries in it */ 785 int sg_max_nents; /* Maximum number of entries in it */
783 int sg_nents; /* Current number of entries in it */
784 int orig_sg_nents;
785 int sg_dma_direction; /* dma transfer direction */
786
787 /* data phase of the active command (currently only valid for PIO/DMA) */
788 int data_phase;
789 786
790 struct ide_task_s task; /* current command */ 787 struct ide_cmd cmd; /* current command */
791
792 unsigned int nsect;
793 unsigned int nleft;
794 struct scatterlist *cursg;
795 unsigned int cursg_ofs;
796 788
797 int rqsize; /* max sectors per request */ 789 int rqsize; /* max sectors per request */
798 int irq; /* our irq number */ 790 int irq; /* our irq number */
@@ -850,9 +842,18 @@ struct ide_host {
850 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 842 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
851 unsigned int n_ports; 843 unsigned int n_ports;
852 struct device *dev[2]; 844 struct device *dev[2];
845
853 int (*init_chipset)(struct pci_dev *); 846 int (*init_chipset)(struct pci_dev *);
847
848 void (*get_lock)(irq_handler_t, void *);
849 void (*release_lock)(void);
850
854 irq_handler_t irq_handler; 851 irq_handler_t irq_handler;
852
855 unsigned long host_flags; 853 unsigned long host_flags;
854
855 int irq_flags;
856
856 void *host_priv; 857 void *host_priv;
857 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 858 ide_hwif_t *cur_port; /* for hosts requiring serialization */
858 859
@@ -869,7 +870,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
869typedef int (ide_expiry_t)(ide_drive_t *); 870typedef int (ide_expiry_t)(ide_drive_t *);
870 871
871/* used by ide-cd, ide-floppy, etc. */ 872/* used by ide-cd, ide-floppy, etc. */
872typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 873typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
873 874
874extern struct mutex ide_setting_mtx; 875extern struct mutex ide_setting_mtx;
875 876
@@ -1045,10 +1046,11 @@ enum {
1045}; 1046};
1046 1047
1047/* DRV_NAME has to be defined in the driver before using the macro below */ 1048/* DRV_NAME has to be defined in the driver before using the macro below */
1048#define __ide_debug_log(lvl, fmt, args...) \ 1049#define __ide_debug_log(lvl, fmt, args...) \
1049{ \ 1050{ \
1050 if (unlikely(drive->debug_mask & lvl)) \ 1051 if (unlikely(drive->debug_mask & lvl)) \
1051 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ 1052 printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \
1053 __func__, ## args); \
1052} 1054}
1053 1055
1054/* 1056/*
@@ -1087,7 +1089,7 @@ int generic_ide_resume(struct device *);
1087 1089
1088void ide_complete_power_step(ide_drive_t *, struct request *); 1090void ide_complete_power_step(ide_drive_t *, struct request *);
1089ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); 1091ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1090void ide_complete_pm_request(ide_drive_t *, struct request *); 1092void ide_complete_pm_rq(ide_drive_t *, struct request *);
1091void ide_check_pm_state(ide_drive_t *, struct request *); 1093void ide_check_pm_state(ide_drive_t *, struct request *);
1092 1094
1093/* 1095/*
@@ -1099,7 +1101,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
1099struct ide_driver { 1101struct ide_driver {
1100 const char *version; 1102 const char *version;
1101 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1103 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1102 int (*end_request)(ide_drive_t *, int, int);
1103 struct device_driver gen_driver; 1104 struct device_driver gen_driver;
1104 int (*probe)(ide_drive_t *); 1105 int (*probe)(ide_drive_t *);
1105 void (*remove)(ide_drive_t *); 1106 void (*remove)(ide_drive_t *);
@@ -1130,19 +1131,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1130extern int ide_vlb_clk; 1131extern int ide_vlb_clk;
1131extern int ide_pci_clk; 1132extern int ide_pci_clk;
1132 1133
1133int ide_end_request(ide_drive_t *, int, int); 1134unsigned int ide_rq_bytes(struct request *);
1134int ide_end_dequeued_request(ide_drive_t *, struct request *, int, int); 1135int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
1135void ide_kill_rq(ide_drive_t *, struct request *); 1136void ide_kill_rq(ide_drive_t *, struct request *);
1136 1137
1137void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int, 1138void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1138 ide_expiry_t *); 1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int,
1140 ide_expiry_t *);
1141
1142void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
1143 ide_expiry_t *);
1144 1140
1145void ide_execute_pkt_cmd(ide_drive_t *); 1141void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
1142 unsigned int);
1146 1143
1147void ide_pad_transfer(ide_drive_t *, int, int); 1144void ide_pad_transfer(ide_drive_t *, int, int);
1148 1145
@@ -1164,7 +1161,8 @@ extern ide_startstop_t ide_do_reset (ide_drive_t *);
1164extern int ide_devset_execute(ide_drive_t *drive, 1161extern int ide_devset_execute(ide_drive_t *drive,
1165 const struct ide_devset *setting, int arg); 1162 const struct ide_devset *setting, int arg);
1166 1163
1167extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1164void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
1165int ide_complete_rq(ide_drive_t *, int, unsigned int);
1168 1166
1169void ide_tf_dump(const char *, struct ide_taskfile *); 1167void ide_tf_dump(const char *, struct ide_taskfile *);
1170 1168
@@ -1174,11 +1172,11 @@ u8 ide_read_altstatus(ide_hwif_t *);
1174 1172
1175void ide_set_irq(ide_hwif_t *, int); 1173void ide_set_irq(ide_hwif_t *, int);
1176 1174
1177void ide_tf_load(ide_drive_t *, ide_task_t *); 1175void ide_tf_load(ide_drive_t *, struct ide_cmd *);
1178void ide_tf_read(ide_drive_t *, ide_task_t *); 1176void ide_tf_read(ide_drive_t *, struct ide_cmd *);
1179 1177
1180void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); 1178void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1181void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); 1179void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1182 1180
1183int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); 1181int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1184 1182
@@ -1224,16 +1222,16 @@ int ide_cd_expiry(ide_drive_t *);
1224 1222
1225int ide_cd_get_xferlen(struct request *); 1223int ide_cd_get_xferlen(struct request *);
1226 1224
1227ide_startstop_t ide_issue_pc(ide_drive_t *); 1225ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
1228 1226
1229ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1227ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
1230 1228
1231void task_end_request(ide_drive_t *, struct request *, u8); 1229void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
1232 1230
1233int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); 1231int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
1234int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1232int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1235 1233
1236int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1234int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1237 1235
1238int ide_dev_read_id(ide_drive_t *, u8, u16 *); 1236int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1239 1237
@@ -1335,6 +1333,10 @@ enum {
1335 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1333 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1336 /* serialize ports */ 1334 /* serialize ports */
1337 IDE_HFLAG_SERIALIZE = (1 << 20), 1335 IDE_HFLAG_SERIALIZE = (1 << 20),
1336 /* host is DTC2278 */
1337 IDE_HFLAG_DTC2278 = (1 << 21),
1338 /* 4 devices on a single set of I/O ports */
1339 IDE_HFLAG_4DRIVES = (1 << 22),
1338 /* host is TRM290 */ 1340 /* host is TRM290 */
1339 IDE_HFLAG_TRM290 = (1 << 23), 1341 IDE_HFLAG_TRM290 = (1 << 23),
1340 /* use 32-bit I/O ops */ 1342 /* use 32-bit I/O ops */
@@ -1362,7 +1364,12 @@ enum {
1362 1364
1363struct ide_port_info { 1365struct ide_port_info {
1364 char *name; 1366 char *name;
1367
1365 int (*init_chipset)(struct pci_dev *); 1368 int (*init_chipset)(struct pci_dev *);
1369
1370 void (*get_lock)(irq_handler_t, void *);
1371 void (*release_lock)(void);
1372
1366 void (*init_iops)(ide_hwif_t *); 1373 void (*init_iops)(ide_hwif_t *);
1367 void (*init_hwif)(ide_hwif_t *); 1374 void (*init_hwif)(ide_hwif_t *);
1368 int (*init_dma)(ide_hwif_t *, 1375 int (*init_dma)(ide_hwif_t *,
@@ -1379,6 +1386,9 @@ struct ide_port_info {
1379 u16 max_sectors; /* if < than the default one */ 1386 u16 max_sectors; /* if < than the default one */
1380 1387
1381 u32 host_flags; 1388 u32 host_flags;
1389
1390 int irq_flags;
1391
1382 u8 pio_mask; 1392 u8 pio_mask;
1383 u8 swdma_mask; 1393 u8 swdma_mask;
1384 u8 mwdma_mask; 1394 u8 mwdma_mask;
@@ -1398,8 +1408,8 @@ int ide_pci_resume(struct pci_dev *);
1398#define ide_pci_resume NULL 1408#define ide_pci_resume NULL
1399#endif 1409#endif
1400 1410
1401void ide_map_sg(ide_drive_t *, struct request *); 1411void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1402void ide_init_sg_cmd(ide_drive_t *, struct request *); 1412void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1403 1413
1404#define BAD_DMA_DRIVE 0 1414#define BAD_DMA_DRIVE 0
1405#define GOOD_DMA_DRIVE 1 1415#define GOOD_DMA_DRIVE 1
@@ -1433,18 +1443,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *);
1433int ide_allocate_dma_engine(ide_hwif_t *); 1443int ide_allocate_dma_engine(ide_hwif_t *);
1434void ide_release_dma_engine(ide_hwif_t *); 1444void ide_release_dma_engine(ide_hwif_t *);
1435 1445
1436int ide_build_sglist(ide_drive_t *, struct request *); 1446int ide_build_sglist(ide_drive_t *, struct ide_cmd *);
1437void ide_destroy_dmatable(ide_drive_t *); 1447void ide_destroy_dmatable(ide_drive_t *);
1438 1448
1439#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1449#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1440int config_drive_for_dma(ide_drive_t *); 1450int config_drive_for_dma(ide_drive_t *);
1441extern int ide_build_dmatable(ide_drive_t *, struct request *); 1451int ide_build_dmatable(ide_drive_t *, struct ide_cmd *);
1442void ide_dma_host_set(ide_drive_t *, int); 1452void ide_dma_host_set(ide_drive_t *, int);
1443extern int ide_dma_setup(ide_drive_t *); 1453int ide_dma_setup(ide_drive_t *, struct ide_cmd *);
1444void ide_dma_exec_cmd(ide_drive_t *, u8);
1445extern void ide_dma_start(ide_drive_t *); 1454extern void ide_dma_start(ide_drive_t *);
1446int ide_dma_end(ide_drive_t *); 1455int ide_dma_end(ide_drive_t *);
1447int ide_dma_test_irq(ide_drive_t *); 1456int ide_dma_test_irq(ide_drive_t *);
1457int ide_dma_sff_timer_expiry(ide_drive_t *);
1448u8 ide_dma_sff_read_status(ide_hwif_t *); 1458u8 ide_dma_sff_read_status(ide_hwif_t *);
1449extern const struct ide_dma_ops sff_dma_ops; 1459extern const struct ide_dma_ops sff_dma_ops;
1450#else 1460#else
@@ -1465,8 +1475,11 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1465static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1475static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1466static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1476static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1467static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1477static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1478static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; }
1468static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } 1479static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
1469static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1480static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1481static inline int ide_build_sglist(ide_drive_t *drive,
1482 struct ide_cmd *cmd) { return 0; }
1470#endif /* CONFIG_BLK_DEV_IDEDMA */ 1483#endif /* CONFIG_BLK_DEV_IDEDMA */
1471 1484
1472#ifdef CONFIG_BLK_DEV_IDEACPI 1485#ifdef CONFIG_BLK_DEV_IDEACPI
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index d2e3cbfba14f..1d6c71d96ede 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -292,6 +292,8 @@ struct intel_iommu {
292 spinlock_t register_lock; /* protect register handling */ 292 spinlock_t register_lock; /* protect register handling */
293 int seq_id; /* sequence id of the iommu */ 293 int seq_id; /* sequence id of the iommu */
294 int agaw; /* agaw of this iommu */ 294 int agaw; /* agaw of this iommu */
295 unsigned int irq;
296 unsigned char name[13]; /* Device Name */
295 297
296#ifdef CONFIG_DMAR 298#ifdef CONFIG_DMAR
297 unsigned long *domain_ids; /* bitmap of domains */ 299 unsigned long *domain_ids; /* bitmap of domains */
@@ -299,8 +301,6 @@ struct intel_iommu {
299 spinlock_t lock; /* protect context, domain ids */ 301 spinlock_t lock; /* protect context, domain ids */
300 struct root_entry *root_entry; /* virtual address */ 302 struct root_entry *root_entry; /* virtual address */
301 303
302 unsigned int irq;
303 unsigned char name[7]; /* Device Name */
304 struct iommu_flush flush; 304 struct iommu_flush flush;
305#endif 305#endif
306 struct q_inval *qi; /* Queued invalidation info */ 306 struct q_inval *qi; /* Queued invalidation info */
@@ -321,6 +321,7 @@ extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
321extern int alloc_iommu(struct dmar_drhd_unit *drhd); 321extern int alloc_iommu(struct dmar_drhd_unit *drhd);
322extern void free_iommu(struct intel_iommu *iommu); 322extern void free_iommu(struct intel_iommu *iommu);
323extern int dmar_enable_qi(struct intel_iommu *iommu); 323extern int dmar_enable_qi(struct intel_iommu *iommu);
324extern void dmar_disable_qi(struct intel_iommu *iommu);
324extern void qi_global_iec(struct intel_iommu *iommu); 325extern void qi_global_iec(struct intel_iommu *iommu);
325 326
326extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, 327extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
@@ -331,11 +332,4 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
331 332
332extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 333extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
333 334
334extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
335extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
336extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
337extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
338extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
339extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
340
341#endif 335#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 0c9cb63e6895..c68bffd182bb 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -117,6 +117,15 @@ extern void disable_irq_nosync(unsigned int irq);
117extern void disable_irq(unsigned int irq); 117extern void disable_irq(unsigned int irq);
118extern void enable_irq(unsigned int irq); 118extern void enable_irq(unsigned int irq);
119 119
120/* The following three functions are for the core kernel use only. */
121extern void suspend_device_irqs(void);
122extern void resume_device_irqs(void);
123#ifdef CONFIG_PM_SLEEP
124extern int check_wakeup_irqs(void);
125#else
126static inline int check_wakeup_irqs(void) { return 0; }
127#endif
128
120#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 129#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
121 130
122extern cpumask_var_t irq_default_affinity; 131extern cpumask_var_t irq_default_affinity;
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 62b73668b602..f7c9c75a2775 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
230 automatically be dstroyed when the interface is destroyed. */ 230 automatically be dstroyed when the interface is destroyed. */
231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
232 read_proc_t *read_proc, 232 read_proc_t *read_proc,
233 void *data, struct module *owner); 233 void *data);
234 234
235#endif /* __LINUX_IPMI_SMI_H */ 235#endif /* __LINUX_IPMI_SMI_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 9c62fbe2ef30..974890b3c52f 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -67,6 +67,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
67#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 67#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
68#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 68#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
69#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 69#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
70#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */
70 71
71#ifdef CONFIG_IRQ_PER_CPU 72#ifdef CONFIG_IRQ_PER_CPU
72# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 73# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index f2720280b9ec..062d20f74322 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -60,10 +60,10 @@ struct ivtv_dma_frame {
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62 62
63/* These are the VBI types as they appear in the embedded VBI private packets. */ 63/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B (1) 64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
65#define IVTV_SLICED_TYPE_CAPTION_525 (4) 65#define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525
66#define IVTV_SLICED_TYPE_WSS_625 (5) 66#define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625
67#define IVTV_SLICED_TYPE_VPS (7) 67#define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS
68 68
69#endif /* _LINUX_IVTV_H */ 69#endif /* _LINUX_IVTV_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 23bf02fb124f..5a58ea3e91e9 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -20,43 +20,10 @@ struct lockdep_map;
20#include <linux/stacktrace.h> 20#include <linux/stacktrace.h>
21 21
22/* 22/*
23 * Lock-class usage-state bits: 23 * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
24 * the total number of states... :-(
24 */ 25 */
25enum lock_usage_bit 26#define XXX_LOCK_USAGE_STATES (1+3*4)
26{
27 LOCK_USED = 0,
28 LOCK_USED_IN_HARDIRQ,
29 LOCK_USED_IN_SOFTIRQ,
30 LOCK_ENABLED_SOFTIRQS,
31 LOCK_ENABLED_HARDIRQS,
32 LOCK_USED_IN_HARDIRQ_READ,
33 LOCK_USED_IN_SOFTIRQ_READ,
34 LOCK_ENABLED_SOFTIRQS_READ,
35 LOCK_ENABLED_HARDIRQS_READ,
36 LOCK_USAGE_STATES
37};
38
39/*
40 * Usage-state bitmasks:
41 */
42#define LOCKF_USED (1 << LOCK_USED)
43#define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ)
44#define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ)
45#define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS)
46#define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS)
47
48#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS)
49#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
50
51#define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ)
52#define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ)
53#define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ)
54#define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ)
55
56#define LOCKF_ENABLED_IRQS_READ \
57 (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ)
58#define LOCKF_USED_IN_IRQ_READ \
59 (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
60 27
61#define MAX_LOCKDEP_SUBCLASSES 8UL 28#define MAX_LOCKDEP_SUBCLASSES 8UL
62 29
@@ -97,7 +64,7 @@ struct lock_class {
97 * IRQ/softirq usage tracking bits: 64 * IRQ/softirq usage tracking bits:
98 */ 65 */
99 unsigned long usage_mask; 66 unsigned long usage_mask;
100 struct stack_trace usage_traces[LOCK_USAGE_STATES]; 67 struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES];
101 68
102 /* 69 /*
103 * These fields represent a directed graph of lock dependencies, 70 * These fields represent a directed graph of lock dependencies,
@@ -324,7 +291,11 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
324 lock_set_class(lock, lock->name, lock->key, subclass, ip); 291 lock_set_class(lock, lock->name, lock->key, subclass, ip);
325} 292}
326 293
327# define INIT_LOCKDEP .lockdep_recursion = 0, 294extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask);
295extern void lockdep_clear_current_reclaim_state(void);
296extern void lockdep_trace_alloc(gfp_t mask);
297
298# define INIT_LOCKDEP .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0,
328 299
329#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 300#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
330 301
@@ -342,6 +313,9 @@ static inline void lockdep_on(void)
342# define lock_release(l, n, i) do { } while (0) 313# define lock_release(l, n, i) do { } while (0)
343# define lock_set_class(l, n, k, s, i) do { } while (0) 314# define lock_set_class(l, n, k, s, i) do { } while (0)
344# define lock_set_subclass(l, s, i) do { } while (0) 315# define lock_set_subclass(l, s, i) do { } while (0)
316# define lockdep_set_current_reclaim_state(g) do { } while (0)
317# define lockdep_clear_current_reclaim_state() do { } while (0)
318# define lockdep_trace_alloc(g) do { } while (0)
345# define lockdep_init() do { } while (0) 319# define lockdep_init() do { } while (0)
346# define lockdep_info() do { } while (0) 320# define lockdep_info() do { } while (0)
347# define lockdep_init_map(lock, name, key, sub) \ 321# define lockdep_init_map(lock, name, key, sub) \
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 065cdf8c09fb..b1ea37fc7a24 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -104,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107 108
108#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
109#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -145,7 +146,7 @@ extern pgprot_t protection_map[16];
145 */ 146 */
146static inline int is_linear_pfn_mapping(struct vm_area_struct *vma) 147static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
147{ 148{
148 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff); 149 return (vma->vm_flags & VM_PFN_AT_MMAP);
149} 150}
150 151
151static inline int is_pfn_mapping(struct vm_area_struct *vma) 152static inline int is_pfn_mapping(struct vm_area_struct *vma)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 7a0e5c4f8072..3069ec7e0ab8 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -50,8 +50,10 @@ struct mutex {
50 atomic_t count; 50 atomic_t count;
51 spinlock_t wait_lock; 51 spinlock_t wait_lock;
52 struct list_head wait_list; 52 struct list_head wait_list;
53#ifdef CONFIG_DEBUG_MUTEXES 53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
54 struct thread_info *owner; 54 struct thread_info *owner;
55#endif
56#ifdef CONFIG_DEBUG_MUTEXES
55 const char *name; 57 const char *name;
56 void *magic; 58 void *magic;
57#endif 59#endif
@@ -68,7 +70,6 @@ struct mutex_waiter {
68 struct list_head list; 70 struct list_head list;
69 struct task_struct *task; 71 struct task_struct *task;
70#ifdef CONFIG_DEBUG_MUTEXES 72#ifdef CONFIG_DEBUG_MUTEXES
71 struct mutex *lock;
72 void *magic; 73 void *magic;
73#endif 74#endif
74}; 75};
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7bd624bfdcfd..df3644132617 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -689,6 +689,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
689/* Power management related routines */ 689/* Power management related routines */
690int pci_save_state(struct pci_dev *dev); 690int pci_save_state(struct pci_dev *dev);
691int pci_restore_state(struct pci_dev *dev); 691int pci_restore_state(struct pci_dev *dev);
692int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
692int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 693int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
693pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 694pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
694bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 695bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2c9e8080da5e..e5816dd33371 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2232,6 +2232,14 @@
2232#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2232#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2233 2233
2234#define PCI_VENDOR_ID_FREESCALE 0x1957 2234#define PCI_VENDOR_ID_FREESCALE 0x1957
2235#define PCI_DEVICE_ID_MPC8315E 0x00b4
2236#define PCI_DEVICE_ID_MPC8315 0x00b5
2237#define PCI_DEVICE_ID_MPC8314E 0x00b6
2238#define PCI_DEVICE_ID_MPC8314 0x00b7
2239#define PCI_DEVICE_ID_MPC8378E 0x00c4
2240#define PCI_DEVICE_ID_MPC8378 0x00c5
2241#define PCI_DEVICE_ID_MPC8377E 0x00c6
2242#define PCI_DEVICE_ID_MPC8377 0x00c7
2235#define PCI_DEVICE_ID_MPC8548E 0x0012 2243#define PCI_DEVICE_ID_MPC8548E 0x0012
2236#define PCI_DEVICE_ID_MPC8548 0x0013 2244#define PCI_DEVICE_ID_MPC8548 0x0013
2237#define PCI_DEVICE_ID_MPC8543E 0x0014 2245#define PCI_DEVICE_ID_MPC8543E 0x0014
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index b8bdb96eff78..fbfa3d44d33d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -41,9 +41,6 @@ enum {
41 * while parent/subdir create the directory structure (every 41 * while parent/subdir create the directory structure (every
42 * /proc file has a parent, but "subdir" is NULL for all 42 * /proc file has a parent, but "subdir" is NULL for all
43 * non-directory entries). 43 * non-directory entries).
44 *
45 * "owner" is used to protect module
46 * from unloading while proc_dir_entry is in use
47 */ 44 */
48 45
49typedef int (read_proc_t)(char *page, char **start, off_t off, 46typedef int (read_proc_t)(char *page, char **start, off_t off,
@@ -70,7 +67,6 @@ struct proc_dir_entry {
70 * somewhere. 67 * somewhere.
71 */ 68 */
72 const struct file_operations *proc_fops; 69 const struct file_operations *proc_fops;
73 struct module *owner;
74 struct proc_dir_entry *next, *parent, *subdir; 70 struct proc_dir_entry *next, *parent, *subdir;
75 void *data; 71 void *data;
76 read_proc_t *read_proc; 72 read_proc_t *read_proc;
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index fe00f781a622..8cc65757e47a 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -49,13 +49,12 @@ static inline int reiserfs_acl_count(size_t size)
49#ifdef CONFIG_REISERFS_FS_POSIX_ACL 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51int reiserfs_acl_chmod(struct inode *inode); 51int reiserfs_acl_chmod(struct inode *inode);
52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, 52int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry,
53 struct inode *inode); 54 struct inode *inode);
54int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
55extern int reiserfs_xattr_posix_acl_init(void) __init; 56extern struct xattr_handler reiserfs_posix_acl_default_handler;
56extern int reiserfs_xattr_posix_acl_exit(void); 57extern struct xattr_handler reiserfs_posix_acl_access_handler;
57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59 58
60static inline void reiserfs_init_acl_access(struct inode *inode) 59static inline void reiserfs_init_acl_access(struct inode *inode)
61{ 60{
@@ -75,23 +74,14 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
75 return NULL; 74 return NULL;
76} 75}
77 76
78static inline int reiserfs_xattr_posix_acl_init(void)
79{
80 return 0;
81}
82
83static inline int reiserfs_xattr_posix_acl_exit(void)
84{
85 return 0;
86}
87
88static inline int reiserfs_acl_chmod(struct inode *inode) 77static inline int reiserfs_acl_chmod(struct inode *inode)
89{ 78{
90 return 0; 79 return 0;
91} 80}
92 81
93static inline int 82static inline int
94reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry, 83reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
84 const struct inode *dir, struct dentry *dentry,
95 struct inode *inode) 85 struct inode *inode)
96{ 86{
97 return 0; 87 return 0;
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index e356c99f0659..2245c78d5876 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -58,8 +58,6 @@
58#define reiserfs_write_lock( sb ) lock_kernel() 58#define reiserfs_write_lock( sb ) lock_kernel()
59#define reiserfs_write_unlock( sb ) unlock_kernel() 59#define reiserfs_write_unlock( sb ) unlock_kernel()
60 60
61/* xattr stuff */
62#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
63struct fid; 61struct fid;
64 62
65/* in reading the #defines, it may help to understand that they employ 63/* in reading the #defines, it may help to understand that they employ
@@ -104,15 +102,21 @@ struct fid;
104*/ 102*/
105#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 103#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
106 104
107void reiserfs_warning(struct super_block *s, const char *fmt, ...); 105void __reiserfs_warning(struct super_block *s, const char *id,
106 const char *func, const char *fmt, ...);
107#define reiserfs_warning(s, id, fmt, args...) \
108 __reiserfs_warning(s, id, __func__, fmt, ##args)
108/* assertions handling */ 109/* assertions handling */
109 110
110/** always check a condition and panic if it's false. */ 111/** always check a condition and panic if it's false. */
111#define __RASSERT( cond, scond, format, args... ) \ 112#define __RASSERT(cond, scond, format, args...) \
112if( !( cond ) ) \ 113do { \
113 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 114 if (!(cond)) \
114 __FILE__ ":%i:%s: " format "\n", \ 115 reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
115 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args ) 116 __FILE__ ":%i:%s: " format "\n", \
117 in_interrupt() ? -1 : task_pid_nr(current), \
118 __LINE__, __func__ , ##args); \
119} while (0)
116 120
117#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 121#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
118 122
@@ -196,7 +200,11 @@ struct reiserfs_super_block {
196 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ 200 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
197 unsigned char s_uuid[16]; /* filesystem unique identifier */ 201 unsigned char s_uuid[16]; /* filesystem unique identifier */
198 unsigned char s_label[16]; /* filesystem volume label */ 202 unsigned char s_label[16]; /* filesystem volume label */
199 char s_unused[88]; /* zero filled by mkreiserfs and 203 __le16 s_mnt_count; /* Count of mounts since last fsck */
204 __le16 s_max_mnt_count; /* Maximum mounts before check */
205 __le32 s_lastcheck; /* Timestamp of last fsck */
206 __le32 s_check_interval; /* Interval between checks */
207 char s_unused[76]; /* zero filled by mkreiserfs and
200 * reiserfs_convert_objectid_map_v1() 208 * reiserfs_convert_objectid_map_v1()
201 * so any additions must be updated 209 * so any additions must be updated
202 * there as well. */ 210 * there as well. */
@@ -578,10 +586,8 @@ static inline int uniqueness2type(__u32 uniqueness)
578 return TYPE_DIRECT; 586 return TYPE_DIRECT;
579 case V1_DIRENTRY_UNIQUENESS: 587 case V1_DIRENTRY_UNIQUENESS:
580 return TYPE_DIRENTRY; 588 return TYPE_DIRENTRY;
581 default:
582 reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
583 uniqueness);
584 case V1_ANY_UNIQUENESS: 589 case V1_ANY_UNIQUENESS:
590 default:
585 return TYPE_ANY; 591 return TYPE_ANY;
586 } 592 }
587} 593}
@@ -598,9 +604,8 @@ static inline __u32 type2uniqueness(int type)
598 return V1_DIRECT_UNIQUENESS; 604 return V1_DIRECT_UNIQUENESS;
599 case TYPE_DIRENTRY: 605 case TYPE_DIRENTRY:
600 return V1_DIRENTRY_UNIQUENESS; 606 return V1_DIRENTRY_UNIQUENESS;
601 default:
602 reiserfs_warning(NULL, "vs-501: unknown type %d", type);
603 case TYPE_ANY: 607 case TYPE_ANY:
608 default:
604 return V1_ANY_UNIQUENESS; 609 return V1_ANY_UNIQUENESS;
605 } 610 }
606} 611}
@@ -712,9 +717,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
712#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) 717#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
713#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) 718#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
714 719
715#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ 720#define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
716 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ 721 (!COMP_SHORT_KEYS(ih, key) && \
717 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) 722 I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
718 723
719/* maximal length of item */ 724/* maximal length of item */
720#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) 725#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
@@ -770,25 +775,25 @@ struct block_head {
770#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ 775#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
771 776
772/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 777/* Given the buffer head of a formatted node, resolve to the block head of that node. */
773#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 778#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
774/* Number of items that are in buffer. */ 779/* Number of items that are in buffer. */
775#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh))) 780#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
776#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh))) 781#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
777#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh))) 782#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
778 783
779#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0) 784#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
780#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 785#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
781#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 786#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
782 787
783/* Get right delimiting key. -- little endian */ 788/* Get right delimiting key. -- little endian */
784#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)))) 789#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
785 790
786/* Does the buffer contain a disk leaf. */ 791/* Does the buffer contain a disk leaf. */
787#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) 792#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
788 793
789/* Does the buffer contain a disk internal node */ 794/* Does the buffer contain a disk internal node */
790#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 795#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
791 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 796 && B_LEVEL(bh) <= MAX_HEIGHT)
792 797
793/***************************************************************************/ 798/***************************************************************************/
794/* STAT DATA */ 799/* STAT DATA */
@@ -1138,12 +1143,13 @@ struct disk_child {
1138#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) 1143#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
1139 1144
1140/* Get disk child by buffer header and position in the tree node. */ 1145/* Get disk child by buffer header and position in the tree node. */
1141#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\ 1146#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
1142((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos))) 1147((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
1143 1148
1144/* Get disk child number by buffer header and position in the tree node. */ 1149/* Get disk child number by buffer header and position in the tree node. */
1145#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1150#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
1146#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1151#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
1152 (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
1147 1153
1148 /* maximal value of field child_size in structure disk_child */ 1154 /* maximal value of field child_size in structure disk_child */
1149 /* child size is the combined size of all items and their headers */ 1155 /* child size is the combined size of all items and their headers */
@@ -1214,33 +1220,33 @@ struct treepath {
1214struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} 1220struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1215 1221
1216/* Get path element by path and path position. */ 1222/* Get path element by path and path position. */
1217#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset)) 1223#define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
1218 1224
1219/* Get buffer header at the path by path and path position. */ 1225/* Get buffer header at the path by path and path position. */
1220#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer) 1226#define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
1221 1227
1222/* Get position in the element at the path by path and path position. */ 1228/* Get position in the element at the path by path and path position. */
1223#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) 1229#define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
1224 1230
1225#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) 1231#define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
1226 /* you know, to the person who didn't 1232 /* you know, to the person who didn't
1227 write this the macro name does not 1233 write this the macro name does not
1228 at first suggest what it does. 1234 at first suggest what it does.
1229 Maybe POSITION_FROM_PATH_END? Or 1235 Maybe POSITION_FROM_PATH_END? Or
1230 maybe we should just focus on 1236 maybe we should just focus on
1231 dumping paths... -Hans */ 1237 dumping paths... -Hans */
1232#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) 1238#define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
1233 1239
1234#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) 1240#define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
1235 1241
1236/* in do_balance leaf has h == 0 in contrast with path structure, 1242/* in do_balance leaf has h == 0 in contrast with path structure,
1237 where root has level == 0. That is why we need these defines */ 1243 where root has level == 0. That is why we need these defines */
1238#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ 1244#define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
1239#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ 1245#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1240#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) 1246#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1241#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ 1247#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1242 1248
1243#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) 1249#define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
1244 1250
1245#define get_last_bh(path) PATH_PLAST_BUFFER(path) 1251#define get_last_bh(path) PATH_PLAST_BUFFER(path)
1246#define get_ih(path) PATH_PITEM_HEAD(path) 1252#define get_ih(path) PATH_PITEM_HEAD(path)
@@ -1470,6 +1476,16 @@ struct buffer_info {
1470 int bi_position; 1476 int bi_position;
1471}; 1477};
1472 1478
1479static inline struct super_block *sb_from_tb(struct tree_balance *tb)
1480{
1481 return tb ? tb->tb_sb : NULL;
1482}
1483
1484static inline struct super_block *sb_from_bi(struct buffer_info *bi)
1485{
1486 return bi ? sb_from_tb(bi->tb) : NULL;
1487}
1488
1473/* there are 4 types of items: stat data, directory item, indirect, direct. 1489/* there are 4 types of items: stat data, directory item, indirect, direct.
1474+-------------------+------------+--------------+------------+ 1490+-------------------+------------+--------------+------------+
1475| | k_offset | k_uniqueness | mergeable? | 1491| | k_offset | k_uniqueness | mergeable? |
@@ -1520,7 +1536,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1];
1520#define COMP_SHORT_KEYS comp_short_keys 1536#define COMP_SHORT_KEYS comp_short_keys
1521 1537
1522/* number of blocks pointed to by the indirect item */ 1538/* number of blocks pointed to by the indirect item */
1523#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE ) 1539#define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
1524 1540
1525/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ 1541/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
1526#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) 1542#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
@@ -1623,6 +1639,10 @@ struct reiserfs_journal_header {
1623#define JOURNAL_MAX_COMMIT_AGE 30 1639#define JOURNAL_MAX_COMMIT_AGE 30
1624#define JOURNAL_MAX_TRANS_AGE 30 1640#define JOURNAL_MAX_TRANS_AGE 30
1625#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1641#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1642#define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \
1643 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
1644 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1645
1626#ifdef CONFIG_QUOTA 1646#ifdef CONFIG_QUOTA
1627/* We need to update data and inode (atime) */ 1647/* We need to update data and inode (atime) */
1628#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1648#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
@@ -1697,7 +1717,7 @@ struct reiserfs_transaction_handle {
1697 int t_refcount; 1717 int t_refcount;
1698 int t_blocks_logged; /* number of blocks this writer has logged */ 1718 int t_blocks_logged; /* number of blocks this writer has logged */
1699 int t_blocks_allocated; /* number of blocks this writer allocated */ 1719 int t_blocks_allocated; /* number of blocks this writer allocated */
1700 unsigned long t_trans_id; /* sanity check, equals the current trans id */ 1720 unsigned int t_trans_id; /* sanity check, equals the current trans id */
1701 void *t_handle_save; /* save existing current->journal_info */ 1721 void *t_handle_save; /* save existing current->journal_info */
1702 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block 1722 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1703 should be displaced from others */ 1723 should be displaced from others */
@@ -1773,13 +1793,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1773int journal_mark_freed(struct reiserfs_transaction_handle *, 1793int journal_mark_freed(struct reiserfs_transaction_handle *,
1774 struct super_block *, b_blocknr_t blocknr); 1794 struct super_block *, b_blocknr_t blocknr);
1775int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); 1795int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1776int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr, 1796int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
1777 int bit_nr, int searchall, b_blocknr_t *next); 1797 int bit_nr, int searchall, b_blocknr_t *next);
1778int journal_begin(struct reiserfs_transaction_handle *, 1798int journal_begin(struct reiserfs_transaction_handle *,
1779 struct super_block *p_s_sb, unsigned long); 1799 struct super_block *sb, unsigned long);
1780int journal_join_abort(struct reiserfs_transaction_handle *, 1800int journal_join_abort(struct reiserfs_transaction_handle *,
1781 struct super_block *p_s_sb, unsigned long); 1801 struct super_block *sb, unsigned long);
1782void reiserfs_journal_abort(struct super_block *sb, int errno); 1802void reiserfs_abort_journal(struct super_block *sb, int errno);
1783void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); 1803void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1784int reiserfs_allocate_list_bitmaps(struct super_block *s, 1804int reiserfs_allocate_list_bitmaps(struct super_block *s,
1785 struct reiserfs_list_bitmap *, unsigned int); 1805 struct reiserfs_list_bitmap *, unsigned int);
@@ -1796,8 +1816,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *);
1796 1816
1797/* stree.c */ 1817/* stree.c */
1798int B_IS_IN_TREE(const struct buffer_head *); 1818int B_IS_IN_TREE(const struct buffer_head *);
1799extern void copy_item_head(struct item_head *p_v_to, 1819extern void copy_item_head(struct item_head *to,
1800 const struct item_head *p_v_from); 1820 const struct item_head *from);
1801 1821
1802// first key is in cpu form, second - le 1822// first key is in cpu form, second - le
1803extern int comp_short_keys(const struct reiserfs_key *le_key, 1823extern int comp_short_keys(const struct reiserfs_key *le_key,
@@ -1832,20 +1852,20 @@ static inline void copy_key(struct reiserfs_key *to,
1832 memcpy(to, from, KEY_SIZE); 1852 memcpy(to, from, KEY_SIZE);
1833} 1853}
1834 1854
1835int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path); 1855int comp_items(const struct item_head *stored_ih, const struct treepath *path);
1836const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, 1856const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
1837 const struct super_block *p_s_sb); 1857 const struct super_block *sb);
1838int search_by_key(struct super_block *, const struct cpu_key *, 1858int search_by_key(struct super_block *, const struct cpu_key *,
1839 struct treepath *, int); 1859 struct treepath *, int);
1840#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) 1860#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1841int search_for_position_by_key(struct super_block *p_s_sb, 1861int search_for_position_by_key(struct super_block *sb,
1842 const struct cpu_key *p_s_cpu_key, 1862 const struct cpu_key *cpu_key,
1843 struct treepath *p_s_search_path); 1863 struct treepath *search_path);
1844extern void decrement_bcount(struct buffer_head *p_s_bh); 1864extern void decrement_bcount(struct buffer_head *bh);
1845void decrement_counters_in_path(struct treepath *p_s_search_path); 1865void decrement_counters_in_path(struct treepath *search_path);
1846void pathrelse(struct treepath *p_s_search_path); 1866void pathrelse(struct treepath *search_path);
1847int reiserfs_check_path(struct treepath *p); 1867int reiserfs_check_path(struct treepath *p);
1848void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path); 1868void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
1849 1869
1850int reiserfs_insert_item(struct reiserfs_transaction_handle *th, 1870int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1851 struct treepath *path, 1871 struct treepath *path,
@@ -1868,14 +1888,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1868int reiserfs_delete_item(struct reiserfs_transaction_handle *th, 1888int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
1869 struct treepath *path, 1889 struct treepath *path,
1870 const struct cpu_key *key, 1890 const struct cpu_key *key,
1871 struct inode *inode, struct buffer_head *p_s_un_bh); 1891 struct inode *inode, struct buffer_head *un_bh);
1872 1892
1873void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, 1893void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
1874 struct inode *inode, struct reiserfs_key *key); 1894 struct inode *inode, struct reiserfs_key *key);
1875int reiserfs_delete_object(struct reiserfs_transaction_handle *th, 1895int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
1876 struct inode *p_s_inode); 1896 struct inode *inode);
1877int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, 1897int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1878 struct inode *p_s_inode, struct page *, 1898 struct inode *inode, struct page *,
1879 int update_timestamps); 1899 int update_timestamps);
1880 1900
1881#define i_block_size(inode) ((inode)->i_sb->s_blocksize) 1901#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
@@ -1919,10 +1939,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
1919 loff_t offset, int type, int length, int entry_count); 1939 loff_t offset, int type, int length, int entry_count);
1920struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); 1940struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
1921 1941
1942struct reiserfs_security_handle;
1922int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 1943int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1923 struct inode *dir, int mode, 1944 struct inode *dir, int mode,
1924 const char *symname, loff_t i_size, 1945 const char *symname, loff_t i_size,
1925 struct dentry *dentry, struct inode *inode); 1946 struct dentry *dentry, struct inode *inode,
1947 struct reiserfs_security_handle *security);
1926 1948
1927void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, 1949void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
1928 struct inode *inode, loff_t size); 1950 struct inode *inode, loff_t size);
@@ -1980,7 +2002,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1980#define PROC_INFO_MAX( sb, field, value ) VOID_V 2002#define PROC_INFO_MAX( sb, field, value ) VOID_V
1981#define PROC_INFO_INC( sb, field ) VOID_V 2003#define PROC_INFO_INC( sb, field ) VOID_V
1982#define PROC_INFO_ADD( sb, field, val ) VOID_V 2004#define PROC_INFO_ADD( sb, field, val ) VOID_V
1983#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V 2005#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
1984#endif 2006#endif
1985 2007
1986/* dir.c */ 2008/* dir.c */
@@ -1988,6 +2010,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
1988extern const struct inode_operations reiserfs_symlink_inode_operations; 2010extern const struct inode_operations reiserfs_symlink_inode_operations;
1989extern const struct inode_operations reiserfs_special_inode_operations; 2011extern const struct inode_operations reiserfs_special_inode_operations;
1990extern const struct file_operations reiserfs_dir_operations; 2012extern const struct file_operations reiserfs_dir_operations;
2013int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
1991 2014
1992/* tail_conversion.c */ 2015/* tail_conversion.c */
1993int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 2016int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -2004,13 +2027,20 @@ extern const struct address_space_operations reiserfs_address_space_operations;
2004 2027
2005/* fix_nodes.c */ 2028/* fix_nodes.c */
2006 2029
2007int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, 2030int fix_nodes(int n_op_mode, struct tree_balance *tb,
2008 struct item_head *p_s_ins_ih, const void *); 2031 struct item_head *ins_ih, const void *);
2009void unfix_nodes(struct tree_balance *); 2032void unfix_nodes(struct tree_balance *);
2010 2033
2011/* prints.c */ 2034/* prints.c */
2012void reiserfs_panic(struct super_block *s, const char *fmt, ...) 2035void __reiserfs_panic(struct super_block *s, const char *id,
2036 const char *function, const char *fmt, ...)
2013 __attribute__ ((noreturn)); 2037 __attribute__ ((noreturn));
2038#define reiserfs_panic(s, id, fmt, args...) \
2039 __reiserfs_panic(s, id, __func__, fmt, ##args)
2040void __reiserfs_error(struct super_block *s, const char *id,
2041 const char *function, const char *fmt, ...);
2042#define reiserfs_error(s, id, fmt, args...) \
2043 __reiserfs_error(s, id, __func__, fmt, ##args)
2014void reiserfs_info(struct super_block *s, const char *fmt, ...); 2044void reiserfs_info(struct super_block *s, const char *fmt, ...);
2015void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); 2045void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
2016void print_indirect_item(struct buffer_head *bh, int item_num); 2046void print_indirect_item(struct buffer_head *bh, int item_num);
@@ -2047,7 +2077,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2047 int zeros_number); 2077 int zeros_number);
2048void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, 2078void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2049 int pos_in_item, int cut_size); 2079 int pos_in_item, int cut_size);
2050void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, 2080void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
2051 int new_entry_count, struct reiserfs_de_head *new_dehs, 2081 int new_entry_count, struct reiserfs_de_head *new_dehs,
2052 const char *records, int paste_size); 2082 const char *records, int paste_size);
2053/* ibalance.c */ 2083/* ibalance.c */
@@ -2203,6 +2233,6 @@ long reiserfs_compat_ioctl(struct file *filp,
2203 unsigned int cmd, unsigned long arg); 2233 unsigned int cmd, unsigned long arg);
2204int reiserfs_unpack(struct inode *inode, struct file *filp); 2234int reiserfs_unpack(struct inode *inode, struct file *filp);
2205 2235
2206
2207#endif /* __KERNEL__ */ 2236#endif /* __KERNEL__ */
2237
2208#endif /* _LINUX_REISER_FS_H */ 2238#endif /* _LINUX_REISER_FS_H */
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index ce3663fb0101..76360b36ac33 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -51,7 +51,7 @@ struct reiserfs_inode_info {
51 /* we use these for fsync or O_SYNC to decide which transaction 51 /* we use these for fsync or O_SYNC to decide which transaction
52 ** needs to be committed in order for this inode to be properly 52 ** needs to be committed in order for this inode to be properly
53 ** flushed */ 53 ** flushed */
54 unsigned long i_trans_id; 54 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 55 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 56 struct mutex i_mmap;
57#ifdef CONFIG_REISERFS_FS_POSIX_ACL 57#ifdef CONFIG_REISERFS_FS_POSIX_ACL
@@ -59,7 +59,7 @@ struct reiserfs_inode_info {
59 struct posix_acl *i_acl_default; 59 struct posix_acl *i_acl_default;
60#endif 60#endif
61#ifdef CONFIG_REISERFS_FS_XATTR 61#ifdef CONFIG_REISERFS_FS_XATTR
62 struct rw_semaphore xattr_sem; 62 struct rw_semaphore i_xattr_sem;
63#endif 63#endif
64 struct inode vfs_inode; 64 struct inode vfs_inode;
65}; 65};
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index bda6b562a1e0..5621d87c4479 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -14,7 +14,7 @@ typedef enum {
14} reiserfs_super_block_flags; 14} reiserfs_super_block_flags;
15 15
16/* struct reiserfs_super_block accessors/mutators 16/* struct reiserfs_super_block accessors/mutators
17 * since this is a disk structure, it will always be in 17 * since this is a disk structure, it will always be in
18 * little endian format. */ 18 * little endian format. */
19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) 19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count))
20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) 20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v))
@@ -73,6 +73,9 @@ typedef enum {
73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) 73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version))
74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) 74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v))
75 75
76#define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count))
77#define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v))
78
76#define sb_reserved_for_journal(sbp) \ 79#define sb_reserved_for_journal(sbp) \
77 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) 80 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
78#define set_sb_reserved_for_journal(sbp,v) \ 81#define set_sb_reserved_for_journal(sbp,v) \
@@ -80,16 +83,16 @@ typedef enum {
80 83
81/* LOGGING -- */ 84/* LOGGING -- */
82 85
83/* These all interelate for performance. 86/* These all interelate for performance.
84** 87**
85** If the journal block count is smaller than n transactions, you lose speed. 88** If the journal block count is smaller than n transactions, you lose speed.
86** I don't know what n is yet, I'm guessing 8-16. 89** I don't know what n is yet, I'm guessing 8-16.
87** 90**
88** typical transaction size depends on the application, how often fsync is 91** typical transaction size depends on the application, how often fsync is
89** called, and how many metadata blocks you dirty in a 30 second period. 92** called, and how many metadata blocks you dirty in a 30 second period.
90** The more small files (<16k) you use, the larger your transactions will 93** The more small files (<16k) you use, the larger your transactions will
91** be. 94** be.
92** 95**
93** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal 96** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal
94** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough 97** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough
95** to prevent wrapping before dirty meta blocks get to disk. 98** to prevent wrapping before dirty meta blocks get to disk.
@@ -153,7 +156,7 @@ struct reiserfs_journal_list {
153 atomic_t j_commit_left; 156 atomic_t j_commit_left;
154 atomic_t j_older_commits_done; /* all commits older than this on disk */ 157 atomic_t j_older_commits_done; /* all commits older than this on disk */
155 struct mutex j_commit_mutex; 158 struct mutex j_commit_mutex;
156 unsigned long j_trans_id; 159 unsigned int j_trans_id;
157 time_t j_timestamp; 160 time_t j_timestamp;
158 struct reiserfs_list_bitmap *j_list_bitmap; 161 struct reiserfs_list_bitmap *j_list_bitmap;
159 struct buffer_head *j_commit_bh; /* commit buffer head */ 162 struct buffer_head *j_commit_bh; /* commit buffer head */
@@ -182,7 +185,7 @@ struct reiserfs_journal {
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 185 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 186
184 unsigned long j_state; 187 unsigned long j_state;
185 unsigned long j_trans_id; 188 unsigned int j_trans_id;
186 unsigned long j_mount_id; 189 unsigned long j_mount_id;
187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ 190 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len; /* length of current waiting commit */ 191 unsigned long j_len; /* length of current waiting commit */
@@ -223,10 +226,10 @@ struct reiserfs_journal {
223 int j_num_work_lists; /* number that need attention from kreiserfsd */ 226 int j_num_work_lists; /* number that need attention from kreiserfsd */
224 227
225 /* debugging to make sure things are flushed in order */ 228 /* debugging to make sure things are flushed in order */
226 int j_last_flush_id; 229 unsigned int j_last_flush_id;
227 230
228 /* debugging to make sure things are committed in order */ 231 /* debugging to make sure things are committed in order */
229 int j_last_commit_id; 232 unsigned int j_last_commit_id;
230 233
231 struct list_head j_bitmap_nodes; 234 struct list_head j_bitmap_nodes;
232 struct list_head j_dirty_buffers; 235 struct list_head j_dirty_buffers;
@@ -239,7 +242,7 @@ struct reiserfs_journal {
239 242
240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ 243 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ 244 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all 245 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
243 the transactions */ 246 the transactions */
244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 247 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
245 int j_persistent_trans; 248 int j_persistent_trans;
@@ -399,10 +402,7 @@ struct reiserfs_sb_info {
399 int reserved_blocks; /* amount of blocks reserved for further allocations */ 402 int reserved_blocks; /* amount of blocks reserved for further allocations */
400 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ 403 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
401 struct dentry *priv_root; /* root of /.reiserfs_priv */ 404 struct dentry *priv_root; /* root of /.reiserfs_priv */
402#ifdef CONFIG_REISERFS_FS_XATTR
403 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ 405 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
404 struct rw_semaphore xattr_dir_sem;
405#endif
406 int j_errno; 406 int j_errno;
407#ifdef CONFIG_QUOTA 407#ifdef CONFIG_QUOTA
408 char *s_qf_names[MAXQUOTAS]; 408 char *s_qf_names[MAXQUOTAS];
@@ -426,7 +426,7 @@ enum reiserfs_mount_options {
426 partition will be dealt with in a 426 partition will be dealt with in a
427 manner of 3.5.x */ 427 manner of 3.5.x */
428 428
429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
431** is not required. If the normal autodection code can't determine which 431** is not required. If the normal autodection code can't determine which
432** hash to use (because both hashes had the same value for a file) 432** hash to use (because both hashes had the same value for a file)
@@ -451,7 +451,6 @@ enum reiserfs_mount_options {
451 REISERFS_NO_UNHASHED_RELOCATION, 451 REISERFS_NO_UNHASHED_RELOCATION,
452 REISERFS_HASHED_RELOCATION, 452 REISERFS_HASHED_RELOCATION,
453 REISERFS_ATTRS, 453 REISERFS_ATTRS,
454 REISERFS_XATTRS,
455 REISERFS_XATTRS_USER, 454 REISERFS_XATTRS_USER,
456 REISERFS_POSIXACL, 455 REISERFS_POSIXACL,
457 REISERFS_BARRIER_NONE, 456 REISERFS_BARRIER_NONE,
@@ -489,7 +488,7 @@ enum reiserfs_mount_options {
489#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) 488#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
490#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) 489#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
491#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) 490#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
492#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS)) 491#define reiserfs_xattrs(s) ((s)->s_xattr != NULL)
493#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) 492#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
494#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) 493#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
495#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) 494#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index af135ae895db..dcae01e63e40 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -15,6 +15,12 @@ struct reiserfs_xattr_header {
15 __le32 h_hash; /* hash of the value */ 15 __le32 h_hash; /* hash of the value */
16}; 16};
17 17
18struct reiserfs_security_handle {
19 char *name;
20 void *value;
21 size_t length;
22};
23
18#ifdef __KERNEL__ 24#ifdef __KERNEL__
19 25
20#include <linux/init.h> 26#include <linux/init.h>
@@ -29,22 +35,13 @@ struct iattr;
29struct super_block; 35struct super_block;
30struct nameidata; 36struct nameidata;
31 37
32struct reiserfs_xattr_handler { 38int reiserfs_xattr_register_handlers(void) __init;
33 char *prefix; 39void reiserfs_xattr_unregister_handlers(void);
34 int (*init) (void); 40int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
35 void (*exit) (void); 41int reiserfs_delete_xattrs(struct inode *inode);
36 int (*get) (struct inode * inode, const char *name, void *buffer, 42int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
37 size_t size);
38 int (*set) (struct inode * inode, const char *name, const void *buffer,
39 size_t size, int flags);
40 int (*del) (struct inode * inode, const char *name);
41 int (*list) (struct inode * inode, const char *name, int namelen,
42 char *out);
43 struct list_head handlers;
44};
45 43
46#ifdef CONFIG_REISERFS_FS_XATTR 44#ifdef CONFIG_REISERFS_FS_XATTR
47#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
48#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 45#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
49ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 46ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
50 void *buffer, size_t size); 47 void *buffer, size_t size);
@@ -52,104 +49,97 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags); 49 const void *value, size_t size, int flags);
53ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 50ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
54int reiserfs_removexattr(struct dentry *dentry, const char *name); 51int reiserfs_removexattr(struct dentry *dentry, const char *name);
55int reiserfs_delete_xattrs(struct inode *inode);
56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
57int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
58int reiserfs_permission(struct inode *inode, int mask); 52int reiserfs_permission(struct inode *inode, int mask);
59 53
60int reiserfs_xattr_del(struct inode *, const char *); 54int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
62int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); 55int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
63 56int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
64extern struct reiserfs_xattr_handler user_handler; 57 struct inode *, const char *, const void *,
65extern struct reiserfs_xattr_handler trusted_handler; 58 size_t, int);
66extern struct reiserfs_xattr_handler security_handler; 59
67 60extern struct xattr_handler reiserfs_xattr_user_handler;
68int reiserfs_xattr_register_handlers(void) __init; 61extern struct xattr_handler reiserfs_xattr_trusted_handler;
69void reiserfs_xattr_unregister_handlers(void); 62extern struct xattr_handler reiserfs_xattr_security_handler;
70 63#ifdef CONFIG_REISERFS_FS_SECURITY
71static inline void reiserfs_write_lock_xattrs(struct super_block *sb) 64int reiserfs_security_init(struct inode *dir, struct inode *inode,
72{ 65 struct reiserfs_security_handle *sec);
73 down_write(&REISERFS_XATTR_DIR_SEM(sb)); 66int reiserfs_security_write(struct reiserfs_transaction_handle *th,
74} 67 struct inode *inode,
75static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) 68 struct reiserfs_security_handle *sec);
76{ 69void reiserfs_security_free(struct reiserfs_security_handle *sec);
77 up_write(&REISERFS_XATTR_DIR_SEM(sb)); 70#endif
78} 71
79static inline void reiserfs_read_lock_xattrs(struct super_block *sb) 72#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
80{ 73static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
81 down_read(&REISERFS_XATTR_DIR_SEM(sb));
82}
83
84static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
85{ 74{
86 up_read(&REISERFS_XATTR_DIR_SEM(sb)); 75 loff_t ret = 0;
76 if (reiserfs_file_data_log(inode)) {
77 ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
78 ret >>= inode->i_sb->s_blocksize_bits;
79 }
80 return ret;
87} 81}
88 82
89static inline void reiserfs_write_lock_xattr_i(struct inode *inode) 83/* We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
90{ 84 * Let's try to be smart about it.
91 down_write(&REISERFS_I(inode)->xattr_sem); 85 * xattr root: We cache it. If it's not cached, we may need to create it.
92} 86 * xattr dir: If anything has been loaded for this inode, we can set a flag
93static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) 87 * saying so.
88 * xattr file: Since we don't cache xattrs, we can't tell. We always include
89 * blocks for it.
90 *
91 * However, since root and dir can be created between calls - YOU MUST SAVE
92 * THIS VALUE.
93 */
94static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
94{ 95{
95 up_write(&REISERFS_I(inode)->xattr_sem); 96 size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
96}
97static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
98{
99 down_read(&REISERFS_I(inode)->xattr_sem);
100}
101 97
102static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) 98 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
103{ 99 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
104 up_read(&REISERFS_I(inode)->xattr_sem); 100 if (REISERFS_SB(inode->i_sb)->xattr_root == NULL)
105} 101 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
102 }
106 103
107static inline void reiserfs_mark_inode_private(struct inode *inode) 104 return nblocks;
108{
109 inode->i_flags |= S_PRIVATE;
110} 105}
111 106
112static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 107static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
113{ 108{
114 init_rwsem(&REISERFS_I(inode)->xattr_sem); 109 init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
115} 110}
116 111
117#else 112#else
118 113
119#define is_reiserfs_priv_object(inode) 0
120#define reiserfs_mark_inode_private(inode) do {;} while(0)
121#define reiserfs_getxattr NULL 114#define reiserfs_getxattr NULL
122#define reiserfs_setxattr NULL 115#define reiserfs_setxattr NULL
123#define reiserfs_listxattr NULL 116#define reiserfs_listxattr NULL
124#define reiserfs_removexattr NULL 117#define reiserfs_removexattr NULL
125#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
126#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
127#define reiserfs_read_lock_xattrs(sb)
128#define reiserfs_read_unlock_xattrs(sb)
129 118
130#define reiserfs_permission NULL 119#define reiserfs_permission NULL
131 120
132#define reiserfs_xattr_register_handlers() 0 121static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
133#define reiserfs_xattr_unregister_handlers()
134
135static inline int reiserfs_delete_xattrs(struct inode *inode)
136{ 122{
137 return 0; 123}
138}; 124#endif /* CONFIG_REISERFS_FS_XATTR */
139static inline int reiserfs_chown_xattrs(struct inode *inode, 125
140 struct iattr *attrs) 126#ifndef CONFIG_REISERFS_FS_SECURITY
127static inline int reiserfs_security_init(struct inode *dir,
128 struct inode *inode,
129 struct reiserfs_security_handle *sec)
141{ 130{
142 return 0; 131 return 0;
143}; 132}
144static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) 133static inline int
134reiserfs_security_write(struct reiserfs_transaction_handle *th,
135 struct inode *inode,
136 struct reiserfs_security_handle *sec)
145{ 137{
146 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
147 return 0; 138 return 0;
148};
149static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
150{
151} 139}
152#endif /* CONFIG_REISERFS_FS_XATTR */ 140static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
141{}
142#endif
153 143
154#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
155 145
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1d19c025f9d2..29df6374d2de 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -331,7 +331,9 @@ extern signed long schedule_timeout(signed long timeout);
331extern signed long schedule_timeout_interruptible(signed long timeout); 331extern signed long schedule_timeout_interruptible(signed long timeout);
332extern signed long schedule_timeout_killable(signed long timeout); 332extern signed long schedule_timeout_killable(signed long timeout);
333extern signed long schedule_timeout_uninterruptible(signed long timeout); 333extern signed long schedule_timeout_uninterruptible(signed long timeout);
334asmlinkage void __schedule(void);
334asmlinkage void schedule(void); 335asmlinkage void schedule(void);
336extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner);
335 337
336struct nsproxy; 338struct nsproxy;
337struct user_namespace; 339struct user_namespace;
@@ -1334,6 +1336,7 @@ struct task_struct {
1334 int lockdep_depth; 1336 int lockdep_depth;
1335 unsigned int lockdep_recursion; 1337 unsigned int lockdep_recursion;
1336 struct held_lock held_locks[MAX_LOCK_DEPTH]; 1338 struct held_lock held_locks[MAX_LOCK_DEPTH];
1339 gfp_t lockdep_reclaim_gfp;
1337#endif 1340#endif
1338 1341
1339/* journalling filesystem info */ 1342/* journalling filesystem info */
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index dedd3c0cfe30..ac9ff54f7cb3 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -31,7 +31,7 @@ extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address); 31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); 32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
33 33
34extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size); 34extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
35 35
36extern void 36extern void
37*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 37*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -41,20 +41,13 @@ extern void
41swiotlb_free_coherent(struct device *hwdev, size_t size, 41swiotlb_free_coherent(struct device *hwdev, size_t size,
42 void *vaddr, dma_addr_t dma_handle); 42 void *vaddr, dma_addr_t dma_handle);
43 43
44extern dma_addr_t 44extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
45swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir); 45 unsigned long offset, size_t size,
46 46 enum dma_data_direction dir,
47extern void 47 struct dma_attrs *attrs);
48swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, 48extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
49 size_t size, int dir); 49 size_t size, enum dma_data_direction dir,
50 50 struct dma_attrs *attrs);
51extern dma_addr_t
52swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
53 int dir, struct dma_attrs *attrs);
54
55extern void
56swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
57 size_t size, int dir, struct dma_attrs *attrs);
58 51
59extern int 52extern int
60swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 53swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
@@ -66,36 +59,38 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
66 59
67extern int 60extern int
68swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 61swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
69 int dir, struct dma_attrs *attrs); 62 enum dma_data_direction dir, struct dma_attrs *attrs);
70 63
71extern void 64extern void
72swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, 65swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
73 int nelems, int dir, struct dma_attrs *attrs); 66 int nelems, enum dma_data_direction dir,
67 struct dma_attrs *attrs);
74 68
75extern void 69extern void
76swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 70swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
77 size_t size, int dir); 71 size_t size, enum dma_data_direction dir);
78 72
79extern void 73extern void
80swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, 74swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
81 int nelems, int dir); 75 int nelems, enum dma_data_direction dir);
82 76
83extern void 77extern void
84swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, 78swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
85 size_t size, int dir); 79 size_t size, enum dma_data_direction dir);
86 80
87extern void 81extern void
88swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 82swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
89 int nelems, int dir); 83 int nelems, enum dma_data_direction dir);
90 84
91extern void 85extern void
92swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 86swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
93 unsigned long offset, size_t size, int dir); 87 unsigned long offset, size_t size,
88 enum dma_data_direction dir);
94 89
95extern void 90extern void
96swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr, 91swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
97 unsigned long offset, size_t size, 92 unsigned long offset, size_t size,
98 int dir); 93 enum dma_data_direction dir);
99 94
100extern int 95extern int
101swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); 96swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index e2d662e3416e..6cdb6f3331f1 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -5,6 +5,7 @@
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/debugobjects.h> 7#include <linux/debugobjects.h>
8#include <linux/stringify.h>
8 9
9struct tvec_base; 10struct tvec_base;
10 11
@@ -21,52 +22,126 @@ struct timer_list {
21 char start_comm[16]; 22 char start_comm[16];
22 int start_pid; 23 int start_pid;
23#endif 24#endif
25#ifdef CONFIG_LOCKDEP
26 struct lockdep_map lockdep_map;
27#endif
24}; 28};
25 29
26extern struct tvec_base boot_tvec_bases; 30extern struct tvec_base boot_tvec_bases;
27 31
32#ifdef CONFIG_LOCKDEP
33/*
34 * NB: because we have to copy the lockdep_map, setting the lockdep_map key
35 * (second argument) here is required, otherwise it could be initialised to
36 * the copy of the lockdep_map later! We use the pointer to and the string
37 * "<file>:<line>" as the key resp. the name of the lockdep_map.
38 */
39#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) \
40 .lockdep_map = STATIC_LOCKDEP_MAP_INIT(_kn, &_kn),
41#else
42#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)
43#endif
44
28#define TIMER_INITIALIZER(_function, _expires, _data) { \ 45#define TIMER_INITIALIZER(_function, _expires, _data) { \
29 .entry = { .prev = TIMER_ENTRY_STATIC }, \ 46 .entry = { .prev = TIMER_ENTRY_STATIC }, \
30 .function = (_function), \ 47 .function = (_function), \
31 .expires = (_expires), \ 48 .expires = (_expires), \
32 .data = (_data), \ 49 .data = (_data), \
33 .base = &boot_tvec_bases, \ 50 .base = &boot_tvec_bases, \
51 __TIMER_LOCKDEP_MAP_INITIALIZER( \
52 __FILE__ ":" __stringify(__LINE__)) \
34 } 53 }
35 54
36#define DEFINE_TIMER(_name, _function, _expires, _data) \ 55#define DEFINE_TIMER(_name, _function, _expires, _data) \
37 struct timer_list _name = \ 56 struct timer_list _name = \
38 TIMER_INITIALIZER(_function, _expires, _data) 57 TIMER_INITIALIZER(_function, _expires, _data)
39 58
40void init_timer(struct timer_list *timer); 59void init_timer_key(struct timer_list *timer,
41void init_timer_deferrable(struct timer_list *timer); 60 const char *name,
61 struct lock_class_key *key);
62void init_timer_deferrable_key(struct timer_list *timer,
63 const char *name,
64 struct lock_class_key *key);
65
66#ifdef CONFIG_LOCKDEP
67#define init_timer(timer) \
68 do { \
69 static struct lock_class_key __key; \
70 init_timer_key((timer), #timer, &__key); \
71 } while (0)
72
73#define init_timer_deferrable(timer) \
74 do { \
75 static struct lock_class_key __key; \
76 init_timer_deferrable_key((timer), #timer, &__key); \
77 } while (0)
78
79#define init_timer_on_stack(timer) \
80 do { \
81 static struct lock_class_key __key; \
82 init_timer_on_stack_key((timer), #timer, &__key); \
83 } while (0)
84
85#define setup_timer(timer, fn, data) \
86 do { \
87 static struct lock_class_key __key; \
88 setup_timer_key((timer), #timer, &__key, (fn), (data));\
89 } while (0)
90
91#define setup_timer_on_stack(timer, fn, data) \
92 do { \
93 static struct lock_class_key __key; \
94 setup_timer_on_stack_key((timer), #timer, &__key, \
95 (fn), (data)); \
96 } while (0)
97#else
98#define init_timer(timer)\
99 init_timer_key((timer), NULL, NULL)
100#define init_timer_deferrable(timer)\
101 init_timer_deferrable_key((timer), NULL, NULL)
102#define init_timer_on_stack(timer)\
103 init_timer_on_stack_key((timer), NULL, NULL)
104#define setup_timer(timer, fn, data)\
105 setup_timer_key((timer), NULL, NULL, (fn), (data))
106#define setup_timer_on_stack(timer, fn, data)\
107 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
108#endif
42 109
43#ifdef CONFIG_DEBUG_OBJECTS_TIMERS 110#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
44extern void init_timer_on_stack(struct timer_list *timer); 111extern void init_timer_on_stack_key(struct timer_list *timer,
112 const char *name,
113 struct lock_class_key *key);
45extern void destroy_timer_on_stack(struct timer_list *timer); 114extern void destroy_timer_on_stack(struct timer_list *timer);
46#else 115#else
47static inline void destroy_timer_on_stack(struct timer_list *timer) { } 116static inline void destroy_timer_on_stack(struct timer_list *timer) { }
48static inline void init_timer_on_stack(struct timer_list *timer) 117static inline void init_timer_on_stack_key(struct timer_list *timer,
118 const char *name,
119 struct lock_class_key *key)
49{ 120{
50 init_timer(timer); 121 init_timer_key(timer, name, key);
51} 122}
52#endif 123#endif
53 124
54static inline void setup_timer(struct timer_list * timer, 125static inline void setup_timer_key(struct timer_list * timer,
126 const char *name,
127 struct lock_class_key *key,
55 void (*function)(unsigned long), 128 void (*function)(unsigned long),
56 unsigned long data) 129 unsigned long data)
57{ 130{
58 timer->function = function; 131 timer->function = function;
59 timer->data = data; 132 timer->data = data;
60 init_timer(timer); 133 init_timer_key(timer, name, key);
61} 134}
62 135
63static inline void setup_timer_on_stack(struct timer_list *timer, 136static inline void setup_timer_on_stack_key(struct timer_list *timer,
137 const char *name,
138 struct lock_class_key *key,
64 void (*function)(unsigned long), 139 void (*function)(unsigned long),
65 unsigned long data) 140 unsigned long data)
66{ 141{
67 timer->function = function; 142 timer->function = function;
68 timer->data = data; 143 timer->data = data;
69 init_timer_on_stack(timer); 144 init_timer_on_stack_key(timer, name, key);
70} 145}
71 146
72/** 147/**
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
deleted file mode 100644
index e26c0c86a6ea..000000000000
--- a/include/linux/video_decoder.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H
3
4#include <linux/types.h>
5
6#define HAVE_VIDEO_DECODER 1
7
8struct video_decoder_capability { /* this name is too long */
9 __u32 flags;
10#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
11#define VIDEO_DECODER_NTSC 2 /* can decode NTSC */
12#define VIDEO_DECODER_SECAM 4 /* can decode SECAM */
13#define VIDEO_DECODER_AUTO 8 /* can autosense norm */
14#define VIDEO_DECODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
15 int inputs; /* number of inputs */
16 int outputs; /* number of outputs */
17};
18
19/*
20DECODER_GET_STATUS returns the following flags. The only one you need is
21DECODER_STATUS_GOOD, the others are just nice things to know.
22*/
23#define DECODER_STATUS_GOOD 1 /* receiving acceptable input */
24#define DECODER_STATUS_COLOR 2 /* receiving color information */
25#define DECODER_STATUS_PAL 4 /* auto detected */
26#define DECODER_STATUS_NTSC 8 /* auto detected */
27#define DECODER_STATUS_SECAM 16 /* auto detected */
28
29struct video_decoder_init {
30 unsigned char len;
31 const unsigned char *data;
32};
33
34#define DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability)
35#define DECODER_GET_STATUS _IOR('d', 2, int)
36#define DECODER_SET_NORM _IOW('d', 3, int)
37#define DECODER_SET_INPUT _IOW('d', 4, int) /* 0 <= input < #inputs */
38#define DECODER_SET_OUTPUT _IOW('d', 5, int) /* 0 <= output < #outputs */
39#define DECODER_ENABLE_OUTPUT _IOW('d', 6, int) /* boolean output enable control */
40#define DECODER_SET_PICTURE _IOW('d', 7, struct video_picture)
41#define DECODER_SET_GPIO _IOW('d', 8, int) /* switch general purpose pin */
42#define DECODER_INIT _IOW('d', 9, struct video_decoder_init) /* init internal registers at once */
43#define DECODER_SET_VBI_BYPASS _IOW('d', 10, int) /* switch vbi bypass */
44
45#define DECODER_DUMP _IO('d', 192) /* debug hook */
46
47
48#endif
diff --git a/include/linux/video_encoder.h b/include/linux/video_encoder.h
deleted file mode 100644
index b7b6423bbb8a..000000000000
--- a/include/linux/video_encoder.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _LINUX_VIDEO_ENCODER_H
2#define _LINUX_VIDEO_ENCODER_H
3
4#include <linux/types.h>
5
6struct video_encoder_capability { /* this name is too long */
7 __u32 flags;
8#define VIDEO_ENCODER_PAL 1 /* can encode PAL signal */
9#define VIDEO_ENCODER_NTSC 2 /* can encode NTSC */
10#define VIDEO_ENCODER_SECAM 4 /* can encode SECAM */
11#define VIDEO_ENCODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
12 int inputs; /* number of inputs */
13 int outputs; /* number of outputs */
14};
15
16#define ENCODER_GET_CAPABILITIES _IOR('e', 1, struct video_encoder_capability)
17#define ENCODER_SET_NORM _IOW('e', 2, int)
18#define ENCODER_SET_INPUT _IOW('e', 3, int) /* 0 <= input < #inputs */
19#define ENCODER_SET_OUTPUT _IOW('e', 4, int) /* 0 <= output < #outputs */
20#define ENCODER_ENABLE_OUTPUT _IOW('e', 5, int) /* boolean output enable control */
21
22
23#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 837f392fbe97..b19eab140977 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -16,6 +16,23 @@
16#include <linux/ioctl.h> 16#include <linux/ioctl.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18 18
19#if defined(__MIN_V4L1) && defined (__KERNEL__)
20
21/*
22 * Used by those V4L2 core functions that need a minimum V4L1 support,
23 * in order to allow V4L1 Compatibilty code compilation.
24 */
25
26struct video_mbuf
27{
28 int size; /* Total memory to map */
29 int frames; /* Frames */
30 int offsets[VIDEO_MAX_FRAME];
31};
32
33#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
34
35#else
19#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 36#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
20 37
21#define VID_TYPE_CAPTURE 1 /* Can capture */ 38#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -312,6 +329,7 @@ struct video_code
312#define VID_PLAY_END_MARK 14 329#define VID_PLAY_END_MARK 14
313 330
314#endif /* CONFIG_VIDEO_V4L1_COMPAT */ 331#endif /* CONFIG_VIDEO_V4L1_COMPAT */
332#endif /* __MIN_V4L1 */
315 333
316#endif /* __LINUX_VIDEODEV_H */ 334#endif /* __LINUX_VIDEODEV_H */
317 335
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5571dbe1c0ad..139d234923cd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -344,6 +344,8 @@ struct v4l2_pix_format {
344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ 344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
347#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
348#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ 350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
349 351
@@ -829,6 +831,7 @@ struct v4l2_querymenu {
829#define V4L2_CTRL_FLAG_UPDATE 0x0008 831#define V4L2_CTRL_FLAG_UPDATE 0x0008
830#define V4L2_CTRL_FLAG_INACTIVE 0x0010 832#define V4L2_CTRL_FLAG_INACTIVE 0x0010
831#define V4L2_CTRL_FLAG_SLIDER 0x0020 833#define V4L2_CTRL_FLAG_SLIDER 0x0020
834#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
832 835
833/* Query flag, to be ORed with the control ID */ 836/* Query flag, to be ORed with the control ID */
834#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 837#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
@@ -879,8 +882,15 @@ enum v4l2_power_line_frequency {
879#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) 882#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
880#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) 883#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
881#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) 884#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
885#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
886enum v4l2_colorfx {
887 V4L2_COLORFX_NONE = 0,
888 V4L2_COLORFX_BW = 1,
889 V4L2_COLORFX_SEPIA = 2,
890};
891
882/* last CID + 1 */ 892/* last CID + 1 */
883#define V4L2_CID_LASTP1 (V4L2_CID_BASE+31) 893#define V4L2_CID_LASTP1 (V4L2_CID_BASE+32)
884 894
885/* MPEG-class control IDs defined by V4L2 */ 895/* MPEG-class control IDs defined by V4L2 */
886#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 896#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1339,6 +1349,53 @@ struct v4l2_sliced_vbi_data {
1339}; 1349};
1340 1350
1341/* 1351/*
1352 * Sliced VBI data inserted into MPEG Streams
1353 */
1354
1355/*
1356 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
1357 *
1358 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
1359 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
1360 * data
1361 *
1362 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
1363 * definitions are not included here. See the MPEG-2 specifications for details
1364 * on these headers.
1365 */
1366
1367/* Line type IDs */
1368#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
1369#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
1370#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
1371#define V4L2_MPEG_VBI_IVTV_VPS (7)
1372
1373struct v4l2_mpeg_vbi_itv0_line {
1374 __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
1375 __u8 data[42]; /* Sliced VBI data for the line */
1376} __attribute__ ((packed));
1377
1378struct v4l2_mpeg_vbi_itv0 {
1379 __le32 linemask[2]; /* Bitmasks of VBI service lines present */
1380 struct v4l2_mpeg_vbi_itv0_line line[35];
1381} __attribute__ ((packed));
1382
1383struct v4l2_mpeg_vbi_ITV0 {
1384 struct v4l2_mpeg_vbi_itv0_line line[36];
1385} __attribute__ ((packed));
1386
1387#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
1388#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
1389
1390struct v4l2_mpeg_vbi_fmt_ivtv {
1391 __u8 magic[4];
1392 union {
1393 struct v4l2_mpeg_vbi_itv0 itv0;
1394 struct v4l2_mpeg_vbi_ITV0 ITV0;
1395 };
1396} __attribute__ ((packed));
1397
1398/*
1342 * A G G R E G A T E S T R U C T U R E S 1399 * A G G R E G A T E S T R U C T U R E S
1343 */ 1400 */
1344 1401
@@ -1403,14 +1460,6 @@ struct v4l2_dbg_chip_ident {
1403 __u32 revision; /* chip revision, chip specific */ 1460 __u32 revision; /* chip revision, chip specific */
1404} __attribute__ ((packed)); 1461} __attribute__ ((packed));
1405 1462
1406/* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */
1407struct v4l2_chip_ident_old {
1408 __u32 match_type; /* Match type */
1409 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1410 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1411 __u32 revision; /* chip revision, chip specific */
1412};
1413
1414/* 1463/*
1415 * I O C T L C O D E S F O R V I D E O D E V I C E S 1464 * I O C T L C O D E S F O R V I D E O D E V I C E S
1416 * 1465 *
@@ -1488,8 +1537,6 @@ struct v4l2_chip_ident_old {
1488/* Experimental, meant for debugging, testing and internal use. 1537/* Experimental, meant for debugging, testing and internal use.
1489 Never use this ioctl in applications! */ 1538 Never use this ioctl in applications! */
1490#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) 1539#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1491/* This is deprecated and will go away in 2.6.30 */
1492#define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old)
1493#endif 1540#endif
1494 1541
1495#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1542#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
diff --git a/include/media/bt819.h b/include/media/bt819.h
new file mode 100644
index 000000000000..38f666bde77a
--- /dev/null
+++ b/include/media/bt819.h
@@ -0,0 +1,33 @@
1/*
2 bt819.h - bt819 notifications
3
4 Copyright (C) 2009 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _BT819_H_
22#define _BT819_H_
23
24#include <linux/ioctl.h>
25
26/* v4l2_device notifications. */
27
28/* Needed to reset the FIFO buffer when changing the input
29 or the video standard. */
30#define BT819_FIFO_RESET_LOW _IO('b', 0)
31#define BT819_FIFO_RESET_HIGH _IO('b', 1)
32
33#endif
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ec4d5889ef5..9ebe8558b9b6 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 cx23415/6 header containing common defines. 2 cx23415/6/8 header containing common defines.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@ enum cx2341x_port {
28enum cx2341x_cap { 28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, 29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30 CX2341X_CAP_HAS_TS = 1 << 1, 30 CX2341X_CAP_HAS_TS = 1 << 1,
31 CX2341X_CAP_HAS_AC3 = 1 << 2,
31}; 32};
32 33
33struct cx2341x_mpeg_params { 34struct cx2341x_mpeg_params {
@@ -47,11 +48,12 @@ struct cx2341x_mpeg_params {
47 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 48 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
48 enum v4l2_mpeg_audio_encoding audio_encoding; 49 enum v4l2_mpeg_audio_encoding audio_encoding;
49 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate; 50 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
51 enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate;
50 enum v4l2_mpeg_audio_mode audio_mode; 52 enum v4l2_mpeg_audio_mode audio_mode;
51 enum v4l2_mpeg_audio_mode_extension audio_mode_extension; 53 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
52 enum v4l2_mpeg_audio_emphasis audio_emphasis; 54 enum v4l2_mpeg_audio_emphasis audio_emphasis;
53 enum v4l2_mpeg_audio_crc audio_crc; 55 enum v4l2_mpeg_audio_crc audio_crc;
54 u16 audio_properties; 56 u32 audio_properties;
55 u16 audio_mute; 57 u16 audio_mute;
56 58
57 /* video */ 59 /* video */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index db431d513f2f..2c3fbaa33f74 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -21,6 +21,18 @@
21#ifndef _CX25840_H_ 21#ifndef _CX25840_H_
22#define _CX25840_H_ 22#define _CX25840_H_
23 23
24/* Note that the cx25840 driver requires that the bridge driver calls the
25 v4l2_subdev's init operation in order to load the driver's firmware.
26 Without this the audio standard detection will fail and you will
27 only get mono.
28
29 Since loading the firmware is often problematic when the driver is
30 compiled into the kernel I recommend postponing calling this function
31 until the first open of the video device. Another reason for
32 postponing it is that loading this firmware takes a long time (seconds)
33 due to the slow i2c bus speed. So it will speed up the boot process if
34 you can avoid loading the fw as long as the video device isn't used. */
35
24enum cx25840_video_input { 36enum cx25840_video_input {
25 /* Composite video inputs In1-In8 */ 37 /* Composite video inputs In1-In8 */
26 CX25840_COMPOSITE1 = 1, 38 CX25840_COMPOSITE1 = 1,
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 5bf2ea00678c..7b5b91f60425 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -111,6 +111,7 @@ extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; 113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 115extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
115extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 116extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
116extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 117extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE];
@@ -159,6 +160,8 @@ extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; 160extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
160extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE]; 161extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE];
161extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE]; 162extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE];
163extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE];
164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE];
162#endif 165#endif
163 166
164/* 167/*
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 00fa57eb9fde..07963d705400 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -14,8 +14,7 @@ struct IR_i2c {
14 /* Used to avoid fast repeating */ 14 /* Used to avoid fast repeating */
15 unsigned char old; 15 unsigned char old;
16 16
17 struct work_struct work; 17 struct delayed_work work;
18 struct timer_list timer;
19 char phys[32]; 18 char phys[32];
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 19 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 20};
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index e391d55edb95..57db48dd85b8 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -13,8 +13,13 @@
13 13
14#include <media/soc_camera.h> 14#include <media/soc_camera.h>
15 15
16/* for flags */
17#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */
18#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */
19
16struct ov772x_camera_info { 20struct ov772x_camera_info {
17 unsigned long buswidth; 21 unsigned long buswidth;
22 unsigned long flags;
18 struct soc_camera_link link; 23 struct soc_camera_link link;
19}; 24};
20 25
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index c5a6e22a4b37..fff4235adae5 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -13,6 +13,7 @@
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <media/v4l2-device.h>
16 17
17#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
18#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
@@ -110,6 +111,8 @@ struct saa7146_dev
110 111
111 struct list_head item; 112 struct list_head item;
112 113
114 struct v4l2_device v4l2_dev;
115
113 /* different device locks */ 116 /* different device locks */
114 spinlock_t slock; 117 spinlock_t slock;
115 struct mutex lock; 118 struct mutex lock;
@@ -145,6 +148,11 @@ struct saa7146_dev
145 struct saa7146_dma d_rps1; 148 struct saa7146_dma d_rps1;
146}; 149};
147 150
151static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
152{
153 return container_of(v4l2_dev, struct saa7146_dev, v4l2_dev);
154}
155
148/* from saa7146_i2c.c */ 156/* from saa7146_i2c.c */
149int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 157int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
150 158
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index c8d0b23fde29..eed5fccc83f3 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -150,16 +150,6 @@ struct saa7146_vv
150 unsigned int resources; /* resource management for device */ 150 unsigned int resources; /* resource management for device */
151}; 151};
152 152
153#define SAA7146_EXCLUSIVE 0x1
154#define SAA7146_BEFORE 0x2
155#define SAA7146_AFTER 0x4
156
157struct saa7146_extension_ioctls
158{
159 unsigned int cmd;
160 int flags;
161};
162
163/* flags */ 153/* flags */
164#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ 154#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */
165 155
@@ -176,8 +166,10 @@ struct saa7146_ext_vv
176 int num_stds; 166 int num_stds;
177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 167 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
178 168
179 struct saa7146_extension_ioctls *ioctls; 169 /* the extension can override this */
180 long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg); 170 struct v4l2_ioctl_ops ops;
171 /* pointer to the saa7146 core ops */
172 const struct v4l2_ioctl_ops *core_ops;
181 173
182 struct v4l2_file_operations vbi_fops; 174 struct v4l2_file_operations vbi_fops;
183}; 175};
@@ -213,6 +205,7 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sy
213void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); 205void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
214 206
215/* from saa7146_video.c */ 207/* from saa7146_video.c */
208extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
216extern struct saa7146_use_ops saa7146_video_uops; 209extern struct saa7146_use_ops saa7146_video_uops;
217int saa7146_start_preview(struct saa7146_fh *fh); 210int saa7146_start_preview(struct saa7146_fh *fh);
218int saa7146_stop_preview(struct saa7146_fh *fh); 211int saa7146_stop_preview(struct saa7146_fh *fh);
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b5dbefea3740..0f3524cff435 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -1,10 +1,11 @@
1#ifndef __ASM_SH_MOBILE_CEU_H__ 1#ifndef __ASM_SH_MOBILE_CEU_H__
2#define __ASM_SH_MOBILE_CEU_H__ 2#define __ASM_SH_MOBILE_CEU_H__
3 3
4#include <media/soc_camera.h> 4#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */
5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
5 6
6struct sh_mobile_ceu_info { 7struct sh_mobile_ceu_info {
7 unsigned long flags; /* SOCAM_... */ 8 unsigned long flags;
8}; 9};
9 10
10#endif /* __ASM_SH_MOBILE_CEU_H__ */ 11#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7440d9250665..37013688af44 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -45,6 +45,7 @@ struct soc_camera_device {
45 int num_formats; 45 int num_formats;
46 struct soc_camera_format_xlate *user_formats; 46 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats; 47 int num_user_formats;
48 enum v4l2_field field; /* Preserve field over close() */
48 struct module *owner; 49 struct module *owner;
49 void *host_priv; /* Per-device host private data */ 50 void *host_priv; /* Per-device host private data */
50 /* soc_camera.c private count. Only accessed with .video_lock held */ 51 /* soc_camera.c private count. Only accessed with .video_lock held */
@@ -74,7 +75,8 @@ struct soc_camera_host_ops {
74 int (*resume)(struct soc_camera_device *); 75 int (*resume)(struct soc_camera_device *);
75 int (*get_formats)(struct soc_camera_device *, int, 76 int (*get_formats)(struct soc_camera_device *, int,
76 struct soc_camera_format_xlate *); 77 struct soc_camera_format_xlate *);
77 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 78 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
79 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 80 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 81 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 82 struct soc_camera_device *);
@@ -93,13 +95,18 @@ struct soc_camera_host_ops {
93struct soc_camera_link { 95struct soc_camera_link {
94 /* Camera bus id, used to match a camera and a bus */ 96 /* Camera bus id, used to match a camera and a bus */
95 int bus_id; 97 int bus_id;
96 /* GPIO number to switch between 8 and 10 bit modes */
97 unsigned int gpio;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 98 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 99 unsigned long flags;
100 /* Optional callbacks to power on or off and reset the sensor */ 100 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 101 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 102 int (*reset)(struct device *);
103 /*
104 * some platforms may support different data widths than the sensors
105 * native ones due to different data line routing. Let the board code
106 * overwrite the width flags.
107 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *);
103}; 110};
104 111
105static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -159,7 +166,8 @@ struct soc_camera_ops {
159 int (*release)(struct soc_camera_device *); 166 int (*release)(struct soc_camera_device *);
160 int (*start_capture)(struct soc_camera_device *); 167 int (*start_capture)(struct soc_camera_device *);
161 int (*stop_capture)(struct soc_camera_device *); 168 int (*stop_capture)(struct soc_camera_device *);
162 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 169 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
170 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
163 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 171 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
164 unsigned long (*query_bus_param)(struct soc_camera_device *); 172 unsigned long (*query_bus_param)(struct soc_camera_device *);
165 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 173 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
@@ -239,15 +247,19 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
239static inline unsigned long soc_camera_bus_param_compatible( 247static inline unsigned long soc_camera_bus_param_compatible(
240 unsigned long camera_flags, unsigned long bus_flags) 248 unsigned long camera_flags, unsigned long bus_flags)
241{ 249{
242 unsigned long common_flags, hsync, vsync, pclk; 250 unsigned long common_flags, hsync, vsync, pclk, data, buswidth, mode;
243 251
244 common_flags = camera_flags & bus_flags; 252 common_flags = camera_flags & bus_flags;
245 253
246 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW); 254 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
247 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW); 255 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
248 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING); 256 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
257 data = common_flags & (SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW);
258 mode = common_flags & (SOCAM_MASTER | SOCAM_SLAVE);
259 buswidth = common_flags & SOCAM_DATAWIDTH_MASK;
249 260
250 return (!hsync || !vsync || !pclk) ? 0 : common_flags; 261 return (!hsync || !vsync || !pclk || !data || !mode || !buswidth) ? 0 :
262 common_flags;
251} 263}
252 264
253extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 265extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 9aaf652b20ef..1be461a29077 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -37,10 +37,8 @@ enum {
37 /* module saa7110: just ident 100 */ 37 /* module saa7110: just ident 100 */
38 V4L2_IDENT_SAA7110 = 100, 38 V4L2_IDENT_SAA7110 = 100,
39 39
40 /* module saa7111: just ident 101 */ 40 /* module saa7115: reserved range 101-149 */
41 V4L2_IDENT_SAA7111 = 101, 41 V4L2_IDENT_SAA7111 = 101,
42
43 /* module saa7115: reserved range 102-149 */
44 V4L2_IDENT_SAA7113 = 103, 42 V4L2_IDENT_SAA7113 = 103,
45 V4L2_IDENT_SAA7114 = 104, 43 V4L2_IDENT_SAA7114 = 104,
46 V4L2_IDENT_SAA7115 = 105, 44 V4L2_IDENT_SAA7115 = 105,
@@ -63,44 +61,96 @@ enum {
63 V4L2_IDENT_OV7720 = 251, 61 V4L2_IDENT_OV7720 = 251,
64 V4L2_IDENT_OV7725 = 252, 62 V4L2_IDENT_OV7725 = 252,
65 63
66 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 64 /* module saa7146: reserved range 300-309 */
65 V4L2_IDENT_SAA7146 = 300,
66
67 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
68 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
67 V4L2_IDENT_CX23415 = 415, 69 V4L2_IDENT_CX23415 = 415,
68 V4L2_IDENT_CX23416 = 416, 70 V4L2_IDENT_CX23416 = 416,
69 V4L2_IDENT_CX23418 = 418, 71 V4L2_IDENT_CX23418 = 418,
70 72
73 /* module au0828 */
74 V4L2_IDENT_AU0828 = 828,
75
76 /* module indycam: just ident 2000 */
77 V4L2_IDENT_INDYCAM = 2000,
78
79 /* module bt819: reserved range 810-819 */
80 V4L2_IDENT_BT815A = 815,
81 V4L2_IDENT_BT817A = 817,
82 V4L2_IDENT_BT819A = 819,
83
84 /* module bt856: just ident 856 */
85 V4L2_IDENT_BT856 = 856,
86
87 /* module bt866: just ident 866 */
88 V4L2_IDENT_BT866 = 866,
89
90 /* module ks0127: reserved range 1120-1129 */
91 V4L2_IDENT_KS0122S = 1122,
92 V4L2_IDENT_KS0127 = 1127,
93 V4L2_IDENT_KS0127B = 1128,
94
71 /* module vp27smpx: just ident 2700 */ 95 /* module vp27smpx: just ident 2700 */
72 V4L2_IDENT_VP27SMPX = 2700, 96 V4L2_IDENT_VP27SMPX = 2700,
73 97
98 /* module vpx3220: reserved range: 3210-3229 */
99 V4L2_IDENT_VPX3214C = 3214,
100 V4L2_IDENT_VPX3216B = 3216,
101 V4L2_IDENT_VPX3220A = 3220,
102
74 /* module tvp5150 */ 103 /* module tvp5150 */
75 V4L2_IDENT_TVP5150 = 5150, 104 V4L2_IDENT_TVP5150 = 5150,
76 105
106 /* module saa5246a: just ident 5246 */
107 V4L2_IDENT_SAA5246A = 5246,
108
109 /* module saa5249: just ident 5249 */
110 V4L2_IDENT_SAA5249 = 5249,
111
77 /* module cs5345: just ident 5345 */ 112 /* module cs5345: just ident 5345 */
78 V4L2_IDENT_CS5345 = 5345, 113 V4L2_IDENT_CS5345 = 5345,
79 114
115 /* module tea6415c: just ident 6415 */
116 V4L2_IDENT_TEA6415C = 6415,
117
118 /* module tea6420: just ident 6420 */
119 V4L2_IDENT_TEA6420 = 6420,
120
121 /* module saa6588: just ident 6588 */
122 V4L2_IDENT_SAA6588 = 6588,
123
80 /* module saa6752hs: reserved range 6750-6759 */ 124 /* module saa6752hs: reserved range 6750-6759 */
81 V4L2_IDENT_SAA6752HS = 6752, 125 V4L2_IDENT_SAA6752HS = 6752,
82 V4L2_IDENT_SAA6752HS_AC3 = 6753, 126 V4L2_IDENT_SAA6752HS_AC3 = 6753,
83 127
128 /* module adv7170: just ident 7170 */
129 V4L2_IDENT_ADV7170 = 7170,
130
131 /* module adv7175: just ident 7175 */
132 V4L2_IDENT_ADV7175 = 7175,
133
134 /* module saa7185: just ident 7185 */
135 V4L2_IDENT_SAA7185 = 7185,
136
137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191,
139
84 /* module wm8739: just ident 8739 */ 140 /* module wm8739: just ident 8739 */
85 V4L2_IDENT_WM8739 = 8739, 141 V4L2_IDENT_WM8739 = 8739,
86 142
87 /* module wm8775: just ident 8775 */ 143 /* module wm8775: just ident 8775 */
88 V4L2_IDENT_WM8775 = 8775, 144 V4L2_IDENT_WM8775 = 8775,
89 145
90 /* module tw9910: just ident 9910 */ 146 /* module tda9840: just ident 9840 */
91 V4L2_IDENT_TW9910 = 9910, 147 V4L2_IDENT_TDA9840 = 9840,
92
93 /* module cs53132a: just ident 53132 */
94 V4L2_IDENT_CS53l32A = 53132,
95
96 /* module upd64031a: just ident 64031 */
97 V4L2_IDENT_UPD64031A = 64031,
98 148
99 /* module upd64083: just ident 64083 */ 149 /* module cafe_ccic, just ident 8801 */
100 V4L2_IDENT_UPD64083 = 64083, 150 V4L2_IDENT_CAFE = 8801,
101 151
102 /* module m52790: just ident 52790 */ 152 /* module tw9910: just ident 9910 */
103 V4L2_IDENT_M52790 = 52790, 153 V4L2_IDENT_TW9910 = 9910,
104 154
105 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 155 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
106 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 156 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
@@ -178,6 +228,18 @@ enum {
178 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 228 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
179 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 229 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
180 V4L2_IDENT_MT9T031 = 45020, 230 V4L2_IDENT_MT9T031 = 45020,
231
232 /* module cs53132a: just ident 53132 */
233 V4L2_IDENT_CS53l32A = 53132,
234
235 /* module upd64031a: just ident 64031 */
236 V4L2_IDENT_UPD64031A = 64031,
237
238 /* module upd64083: just ident 64083 */
239 V4L2_IDENT_UPD64083 = 64083,
240
241 /* module m52790: just ident 52790 */
242 V4L2_IDENT_M52790 = 52790,
181}; 243};
182 244
183#endif 245#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 95e74f1874e1..3a6905615d68 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -102,11 +102,15 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
102const char *v4l2_ctrl_get_name(u32 id); 102const char *v4l2_ctrl_get_name(u32 id);
103const char **v4l2_ctrl_get_menu(u32 id); 103const char **v4l2_ctrl_get_menu(u32 id);
104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
105int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
106int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 105int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
107 struct v4l2_queryctrl *qctrl, const char **menu_items); 106 struct v4l2_queryctrl *qctrl, const char **menu_items);
108#define V4L2_CTRL_MENU_IDS_END (0xffffffff) 107#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
109int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); 108int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
109
110/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
111 0-terminated array of control IDs. Each array must be sorted low to high
112 and belong to the same control class. The array of u32 pointers must also
113 be sorted, from low class IDs to high class IDs. */
110u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); 114u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
111 115
112/* ------------------------------------------------------------------------- */ 116/* ------------------------------------------------------------------------- */
@@ -149,6 +153,21 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
149/* Initialize an v4l2_subdev with data from an i2c_client struct */ 153/* Initialize an v4l2_subdev with data from an i2c_client struct */
150void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 154void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
151 const struct v4l2_subdev_ops *ops); 155 const struct v4l2_subdev_ops *ops);
156/* Return i2c client address of v4l2_subdev. */
157unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
158
159enum v4l2_i2c_tuner_type {
160 ADDRS_RADIO, /* Radio tuner addresses */
161 ADDRS_DEMOD, /* Demod tuner addresses */
162 ADDRS_TV, /* TV tuner addresses */
163 /* TV tuner addresses if demod is present, this excludes
164 addresses used by the demodulator from the list of
165 candidates. */
166 ADDRS_TV_WITH_DEMOD,
167};
168/* Return a list of I2C tuner addresses to probe. Use only if the tuner
169 addresses are unknown. */
170const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
152 171
153/* ------------------------------------------------------------------------- */ 172/* ------------------------------------------------------------------------- */
154 173
@@ -284,4 +303,7 @@ struct v4l2_crystal_freq {
284 a v4l2_gpio struct if a direction is also needed. */ 303 a v4l2_gpio struct if a direction is also needed. */
285#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32) 304#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
286 305
306/* Get input status. Same as the status field in the v4l2_input struct. */
307#define VIDIOC_INT_G_INPUT_STATUS _IOR('d', 118, u32)
308
287#endif /* V4L2_COMMON_H_ */ 309#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index e36faab8459b..2058dd45e915 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -40,6 +40,8 @@ struct v4l2_file_operations {
40 unsigned int (*poll) (struct file *, struct poll_table_struct *); 40 unsigned int (*poll) (struct file *, struct poll_table_struct *);
41 long (*ioctl) (struct file *, unsigned int, unsigned long); 41 long (*ioctl) (struct file *, unsigned int, unsigned long);
42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
43 unsigned long (*get_unmapped_area) (struct file *, unsigned long,
44 unsigned long, unsigned long, unsigned long);
43 int (*mmap) (struct file *, struct vm_area_struct *); 45 int (*mmap) (struct file *, struct vm_area_struct *);
44 int (*open) (struct file *); 46 int (*open) (struct file *);
45 int (*release) (struct file *); 47 int (*release) (struct file *);
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 55e41afd95ef..0dd3e8e8653e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -33,7 +33,9 @@
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16)
34 34
35struct v4l2_device { 35struct v4l2_device {
36 /* dev->driver_data points to this struct */ 36 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device
38 as is the case with e.g. ISA devices. */
37 struct device *dev; 39 struct device *dev;
38 /* used to keep track of the registered subdevs */ 40 /* used to keep track of the registered subdevs */
39 struct list_head subdevs; 41 struct list_head subdevs;
@@ -42,33 +44,43 @@ struct v4l2_device {
42 spinlock_t lock; 44 spinlock_t lock;
43 /* unique device name, by default the driver name + bus ID */ 45 /* unique device name, by default the driver name + bus ID */
44 char name[V4L2_DEVICE_NAME_SIZE]; 46 char name[V4L2_DEVICE_NAME_SIZE];
47 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg);
45}; 50};
46 51
47/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev */ 52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
53 dev may be NULL in rare cases (ISA devices). In that case you
54 must fill in the v4l2_dev->name field before calling this function. */
48int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); 55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
49/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */ 56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
57 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */
50void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 61void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
51 62
52/* Register a subdev with a v4l2 device. While registered the subdev module 63/* Register a subdev with a v4l2 device. While registered the subdev module
53 is marked as in-use. An error is returned if the module is no longer 64 is marked as in-use. An error is returned if the module is no longer
54 loaded when you attempt to register it. */ 65 loaded when you attempt to register it. */
55int __must_check v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd); 66int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
67 struct v4l2_subdev *sd);
56/* Unregister a subdev with a v4l2 device. Can also be called if the subdev 68/* Unregister a subdev with a v4l2 device. Can also be called if the subdev
57 wasn't registered. In that case it will do nothing. */ 69 wasn't registered. In that case it will do nothing. */
58void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); 70void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
59 71
60/* Iterate over all subdevs. */ 72/* Iterate over all subdevs. */
61#define v4l2_device_for_each_subdev(sd, dev) \ 73#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
62 list_for_each_entry(sd, &(dev)->subdevs, list) 74 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
63 75
64/* Call the specified callback for all subdevs matching the condition. 76/* Call the specified callback for all subdevs matching the condition.
65 Ignore any errors. Note that you cannot add or delete a subdev 77 Ignore any errors. Note that you cannot add or delete a subdev
66 while walking the subdevs list. */ 78 while walking the subdevs list. */
67#define __v4l2_device_call_subdevs(dev, cond, o, f, args...) \ 79#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \
68 do { \ 80 do { \
69 struct v4l2_subdev *sd; \ 81 struct v4l2_subdev *sd; \
70 \ 82 \
71 list_for_each_entry(sd, &(dev)->subdevs, list) \ 83 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) \
72 if ((cond) && sd->ops->o && sd->ops->o->f) \ 84 if ((cond) && sd->ops->o && sd->ops->o->f) \
73 sd->ops->o->f(sd , ##args); \ 85 sd->ops->o->f(sd , ##args); \
74 } while (0) 86 } while (0)
@@ -77,12 +89,12 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
77 If the callback returns an error other than 0 or -ENOIOCTLCMD, then 89 If the callback returns an error other than 0 or -ENOIOCTLCMD, then
78 return with that error code. Note that you cannot add or delete a 90 return with that error code. Note that you cannot add or delete a
79 subdev while walking the subdevs list. */ 91 subdev while walking the subdevs list. */
80#define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ 92#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \
81({ \ 93({ \
82 struct v4l2_subdev *sd; \ 94 struct v4l2_subdev *sd; \
83 long err = 0; \ 95 long err = 0; \
84 \ 96 \
85 list_for_each_entry(sd, &(dev)->subdevs, list) { \ 97 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) { \
86 if ((cond) && sd->ops->o && sd->ops->o->f) \ 98 if ((cond) && sd->ops->o && sd->ops->o->f) \
87 err = sd->ops->o->f(sd , ##args); \ 99 err = sd->ops->o->f(sd , ##args); \
88 if (err && err != -ENOIOCTLCMD) \ 100 if (err && err != -ENOIOCTLCMD) \
@@ -94,16 +106,16 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
94/* Call the specified callback for all subdevs matching grp_id (if 0, then 106/* Call the specified callback for all subdevs matching grp_id (if 0, then
95 match them all). Ignore any errors. Note that you cannot add or delete 107 match them all). Ignore any errors. Note that you cannot add or delete
96 a subdev while walking the subdevs list. */ 108 a subdev while walking the subdevs list. */
97#define v4l2_device_call_all(dev, grpid, o, f, args...) \ 109#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \
98 __v4l2_device_call_subdevs(dev, \ 110 __v4l2_device_call_subdevs(v4l2_dev, \
99 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 111 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
100 112
101/* Call the specified callback for all subdevs matching grp_id (if 0, then 113/* Call the specified callback for all subdevs matching grp_id (if 0, then
102 match them all). If the callback returns an error other than 0 or 114 match them all). If the callback returns an error other than 0 or
103 -ENOIOCTLCMD, then return with that error code. Note that you cannot 115 -ENOIOCTLCMD, then return with that error code. Note that you cannot
104 add or delete a subdev while walking the subdevs list. */ 116 add or delete a subdev while walking the subdevs list. */
105#define v4l2_device_call_until_err(dev, grpid, o, f, args...) \ 117#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \
106 __v4l2_device_call_subdevs_until_err(dev, \ 118 __v4l2_device_call_subdevs_until_err(v4l2_dev, \
107 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 119 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
108 120
109#endif 121#endif
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index b01c044868d0..7a4529defa88 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -15,6 +15,7 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */ 16#include <linux/compiler.h> /* need __user */
17#ifdef CONFIG_VIDEO_V4L1_COMPAT 17#ifdef CONFIG_VIDEO_V4L1_COMPAT
18#define __MIN_V4L1
18#include <linux/videodev.h> 19#include <linux/videodev.h>
19#else 20#else
20#include <linux/videodev2.h> 21#include <linux/videodev2.h>
@@ -267,6 +268,7 @@ struct v4l2_ioctl_ops {
267 268
268/* Video standard functions */ 269/* Video standard functions */
269extern const char *v4l2_norm_to_name(v4l2_std_id id); 270extern const char *v4l2_norm_to_name(v4l2_std_id id);
271extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
270extern int v4l2_video_std_construct(struct v4l2_standard *vs, 272extern int v4l2_video_std_construct(struct v4l2_standard *vs,
271 int id, const char *name); 273 int id, const char *name);
272/* Prints the ioctl in a human-readable format */ 274/* Prints the ioctl in a human-readable format */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 37b09e56e943..1d181b4ccb01 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -78,6 +78,9 @@ struct v4l2_subdev_core_ops {
78 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); 78 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
81 int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
82 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
83 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
81 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 84 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
82 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 85 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
83#ifdef CONFIG_VIDEO_ADV_DEBUG 86#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -112,9 +115,17 @@ struct v4l2_subdev_video_ops {
112 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data); 115 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
113 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap); 116 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
114 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 117 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
118 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
119 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
115 int (*s_stream)(struct v4l2_subdev *sd, int enable); 120 int (*s_stream)(struct v4l2_subdev *sd, int enable);
116 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 121 int (*enum_fmt)(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmtdesc);
117 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 122 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
123 int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
124 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
125 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
126 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
127 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
128 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
118}; 129};
119 130
120struct v4l2_subdev_ops { 131struct v4l2_subdev_ops {
@@ -132,7 +143,7 @@ struct v4l2_subdev_ops {
132struct v4l2_subdev { 143struct v4l2_subdev {
133 struct list_head list; 144 struct list_head list;
134 struct module *owner; 145 struct module *owner;
135 struct v4l2_device *dev; 146 struct v4l2_device *v4l2_dev;
136 const struct v4l2_subdev_ops *ops; 147 const struct v4l2_subdev_ops *ops;
137 /* name must be unique */ 148 /* name must be unique */
138 char name[V4L2_SUBDEV_NAME_SIZE]; 149 char name[V4L2_SUBDEV_NAME_SIZE];
@@ -171,7 +182,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
171 /* ops->core MUST be set */ 182 /* ops->core MUST be set */
172 BUG_ON(!ops || !ops->core); 183 BUG_ON(!ops || !ops->core);
173 sd->ops = ops; 184 sd->ops = ops;
174 sd->dev = NULL; 185 sd->v4l2_dev = NULL;
175 sd->name[0] = '\0'; 186 sd->name[0] = '\0';
176 sd->grp_id = 0; 187 sd->grp_id = 0;
177 sd->priv = NULL; 188 sd->priv = NULL;
@@ -186,4 +197,9 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
186 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ 197 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \
187 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 198 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
188 199
200/* Send a notification to v4l2_device. */
201#define v4l2_subdev_notify(sd, notification, arg) \
202 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
203 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
204
189#endif 205#endif
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 874f1340d049..1c5946c44758 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/poll.h> 19#include <linux/poll.h>
20#ifdef CONFIG_VIDEO_V4L1_COMPAT 20#ifdef CONFIG_VIDEO_V4L1_COMPAT
21#define __MIN_V4L1
21#include <linux/videodev.h> 22#include <linux/videodev.h>
22#endif 23#endif
23#include <linux/videodev2.h> 24#include <linux/videodev2.h>
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 426899e529c5..5718a02d3afb 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -22,8 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/videodev.h> 25#include <linux/videodev2.h>
26#include <media/v4l2-dev.h> 26#include <media/v4l2-dev.h>
27#include <media/v4l2-ioctl.h>
27 28
28struct snd_tea575x; 29struct snd_tea575x;
29 30
@@ -35,11 +36,10 @@ struct snd_tea575x_ops {
35 36
36struct snd_tea575x { 37struct snd_tea575x {
37 struct snd_card *card; 38 struct snd_card *card;
38 struct video_device vd; /* video device */ 39 struct video_device *vd; /* video device */
39 struct v4l2_file_operations fops;
40 int dev_nr; /* requested device number + 1 */ 40 int dev_nr; /* requested device number + 1 */
41 int vd_registered; /* video device is registered */
42 int tea5759; /* 5759 chip is present */ 41 int tea5759; /* 5759 chip is present */
42 int mute; /* Device is muted? */
43 unsigned int freq_fixup; /* crystal onboard */ 43 unsigned int freq_fixup; /* crystal onboard */
44 unsigned int val; /* hw value */ 44 unsigned int val; /* hw value */
45 unsigned long freq; /* frequency */ 45 unsigned long freq; /* frequency */