From a96a4922336430fdae584e001efa6e89c37e4685 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 26 Nov 2013 06:16:07 +0000 Subject: [PATCH] ddk:update to 3.12 git-svn-id: svn://kolibrios.org@4292 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/ddk/debug/dbglog.c | 16 +++-- drivers/ddk/linux/workqueue.c | 45 +++++++++++++ drivers/include/drm/drmP.h | 115 +-------------------------------- drivers/include/linux/kernel.h | 8 +++ drivers/include/linux/types.h | 4 -- drivers/include/linux/wait.h | 6 ++ drivers/include/syscall.h | 2 - 7 files changed, 71 insertions(+), 125 deletions(-) diff --git a/drivers/ddk/debug/dbglog.c b/drivers/ddk/debug/dbglog.c index bb964ebb41..847ef5dcd7 100644 --- a/drivers/ddk/debug/dbglog.c +++ b/drivers/ddk/debug/dbglog.c @@ -135,15 +135,17 @@ int dbgprintf(const char* format, ...) if( len ) { - SysMsgBoardStr(txtbuf); - + if( dbgfile.path) + { /* do not write into log file if interrupts disabled */ - if ( (get_eflags() & (1 << 9)) && dbgfile.path) - { - write_file(dbgfile.path,txtbuf,dbgfile.offset,len,&writes); - dbgfile.offset+=writes; - }; + if ( get_eflags() & (1 << 9) ) + { + write_file(dbgfile.path,txtbuf,dbgfile.offset,len,&writes); + dbgfile.offset+=writes; + }; + } + else SysMsgBoardStr(txtbuf); }; return len; } diff --git a/drivers/ddk/linux/workqueue.c b/drivers/ddk/linux/workqueue.c index 98a8ffa63d..d77b1bd82e 100644 --- a/drivers/ddk/linux/workqueue.c +++ b/drivers/ddk/linux/workqueue.c @@ -104,6 +104,51 @@ bool schedule_delayed_work(struct delayed_work *dwork, unsigned long delay) return queue_delayed_work(system_wq, dwork, delay); } +bool mod_delayed_work(struct workqueue_struct *wq, + struct delayed_work *dwork, + unsigned long delay) +{ + return queue_delayed_work(wq, dwork, delay); +} + +int del_timer(struct timer_list *timer) +{ + int ret = 0; + + if(timer->handle) + { + CancelTimerHS(timer->handle); + timer->handle = 0; + ret = 1; + }; + return ret; +}; + +bool cancel_work_sync(struct work_struct *work) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&system_wq->lock, flags); + if(!list_empty(&work->entry)) + { + list_del(&work->entry); + ret = 1; + }; + spin_unlock_irqrestore(&system_wq->lock, flags); + return ret; +} + +bool cancel_delayed_work(struct delayed_work *dwork) +{ + return cancel_work_sync(&dwork->work); +} + +bool cancel_delayed_work_sync(struct delayed_work *dwork) +{ + return cancel_work_sync(&dwork->work); +} + int mod_timer(struct timer_list *timer, unsigned long expires) { int ret = 0; diff --git a/drivers/include/drm/drmP.h b/drivers/include/drm/drmP.h index 951c322217..77fa3aa39e 100644 --- a/drivers/include/drm/drmP.h +++ b/drivers/include/drm/drmP.h @@ -740,6 +740,9 @@ struct drm_bus { void (*agp_destroy)(struct drm_device *dev); }; +#endif + +#define DRM_IRQ_ARGS int irq, void *arg /** * DRM driver structure. This structure represent the common code for @@ -748,17 +751,7 @@ struct drm_bus { */ struct drm_driver { int (*load) (struct drm_device *, unsigned long flags); - int (*firstopen) (struct drm_device *); int (*open) (struct drm_device *, struct drm_file *); - void (*preclose) (struct drm_device *, struct drm_file *file_priv); - void (*postclose) (struct drm_device *, struct drm_file *); - void (*lastclose) (struct drm_device *); - int (*unload) (struct drm_device *); - int (*suspend) (struct drm_device *, pm_message_t state); - int (*resume) (struct drm_device *); - int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); - int (*dma_quiescent) (struct drm_device *); - int (*context_dtor) (struct drm_device *dev, int context); /** * get_vblank_counter - get raw hardware vblank counter @@ -804,20 +797,6 @@ struct drm_driver { * interrupts will have to stay on to keep the count accurate. */ void (*disable_vblank) (struct drm_device *dev, int crtc); - - /** - * Called by \c drm_device_is_agp. Typically used to determine if a - * card is really attached to AGP or not. - * - * \param dev DRM device handle - * - * \returns - * One of three values is returned depending on whether or not the - * card is absolutely \b not AGP (return of 0), absolutely \b is AGP - * (return of 1), or may or may not be AGP (return of 2). - */ - int (*device_is_agp) (struct drm_device *dev); - /** * Called by vblank timestamping code. * @@ -887,22 +866,6 @@ struct drm_driver { int (*irq_postinstall) (struct drm_device *dev); void (*irq_uninstall) (struct drm_device *dev); - /* Master routines */ - int (*master_create)(struct drm_device *dev, struct drm_master *master); - void (*master_destroy)(struct drm_device *dev, struct drm_master *master); - /** - * master_set is called whenever the minor master is set. - * master_drop is called whenever the minor master is dropped. - */ - - int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, - bool from_open); - void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, - bool from_release); - - int (*debugfs_init)(struct drm_minor *minor); - void (*debugfs_cleanup)(struct drm_minor *minor); - /** * Driver-specific constructor for drm_gem_objects, to set up * obj->driver_private. @@ -913,81 +876,9 @@ struct drm_driver { void (*gem_free_object) (struct drm_gem_object *obj); int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); - - /* prime: */ - /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ - int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, - uint32_t handle, uint32_t flags, int *prime_fd); - /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ - int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, - int prime_fd, uint32_t *handle); - /* export GEM -> dmabuf */ - struct dma_buf * (*gem_prime_export)(struct drm_device *dev, - struct drm_gem_object *obj, int flags); - /* import dmabuf -> GEM */ - struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, - struct dma_buf *dma_buf); - - /* vga arb irq handler */ - void (*vgaarb_irq)(struct drm_device *dev, bool state); - - /* dumb alloc support */ - int (*dumb_create)(struct drm_file *file_priv, - struct drm_device *dev, - struct drm_mode_create_dumb *args); - int (*dumb_map_offset)(struct drm_file *file_priv, - struct drm_device *dev, uint32_t handle, - uint64_t *offset); - int (*dumb_destroy)(struct drm_file *file_priv, - struct drm_device *dev, - uint32_t handle); - - /* Driver private ops for this object */ - const struct vm_operations_struct *gem_vm_ops; - - int major; - int minor; - int patchlevel; - char *name; - char *desc; - char *date; - - u32 driver_features; - int dev_priv_size; - const struct drm_ioctl_desc *ioctls; - int num_ioctls; - const struct file_operations *fops; - union { - struct pci_driver *pci; - struct platform_device *platform_device; - struct usb_driver *usb; - } kdriver; - struct drm_bus *bus; - - /* List of devices hanging off this driver */ - struct list_head device_list; -}; - -#endif - -#define DRM_IRQ_ARGS int irq, void *arg - -struct drm_driver { - int (*load) (struct drm_device *, unsigned long flags); - int (*open) (struct drm_device *, struct drm_file *); - - irqreturn_t (*irq_handler) (DRM_IRQ_ARGS); - void (*irq_preinstall) (struct drm_device *dev); - int (*irq_postinstall) (struct drm_device *dev); - - int (*gem_init_object) (struct drm_gem_object *obj); - void (*gem_free_object) (struct drm_gem_object *obj); - int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); - void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); u32 driver_features; }; - #define DRM_MINOR_UNASSIGNED 0 #define DRM_MINOR_LEGACY 1 #define DRM_MINOR_CONTROL 2 diff --git a/drivers/include/linux/kernel.h b/drivers/include/linux/kernel.h index 897150b24d..12855bca56 100644 --- a/drivers/include/linux/kernel.h +++ b/drivers/include/linux/kernel.h @@ -283,6 +283,9 @@ struct timer_list { (_timer)->handle = 0; \ } while (0) +int del_timer(struct timer_list *timer); + +# define del_timer_sync(t) del_timer(t) struct timespec { long tv_sec; /* seconds */ @@ -290,6 +293,11 @@ struct timespec { }; +#define mb() asm volatile("mfence" : : : "memory") +#define rmb() asm volatile("lfence" : : : "memory") +#define wmb() asm volatile("sfence" : : : "memory") + + #define build_mmio_read(name, size, type, reg, barrier) \ static inline type name(const volatile void __iomem *addr) \ { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ diff --git a/drivers/include/linux/types.h b/drivers/include/linux/types.h index e52a9356ec..cd1f10d197 100644 --- a/drivers/include/linux/types.h +++ b/drivers/include/linux/types.h @@ -321,10 +321,6 @@ static inline void *kzalloc(size_t size, uint32_t flags) struct drm_file; -#define DRM_MEMORYBARRIER() __asm__ __volatile__("lock; addl $0,0(%esp)") -#define mb() __asm__ __volatile__("lock; addl $0,0(%esp)") - - #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) diff --git a/drivers/include/linux/wait.h b/drivers/include/linux/wait.h index ca8947167c..29c0983f0d 100644 --- a/drivers/include/linux/wait.h +++ b/drivers/include/linux/wait.h @@ -1,11 +1,13 @@ #ifndef _LINUX_WAIT_H #define _LINUX_WAIT_H + #include #include typedef struct __wait_queue wait_queue_t; typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key); +int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); typedef struct __wait_queue_head wait_queue_head_t; @@ -21,6 +23,10 @@ struct __wait_queue_head spinlock_t lock; struct list_head task_list; }; +static inline int waitqueue_active(wait_queue_head_t *q) +{ + return !list_empty(&q->task_list); +} static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) { diff --git a/drivers/include/syscall.h b/drivers/include/syscall.h index 6d0535d083..9da071476e 100644 --- a/drivers/include/syscall.h +++ b/drivers/include/syscall.h @@ -522,8 +522,6 @@ static inline void __SysMsgBoardStr(char *text) ::"S" (text)); }; -#define rmb() asm volatile("lfence":::"memory") - static inline void *vzalloc(unsigned long size) { void *mem;