From 80104f519266477780666dc3c42e18b9b78fe058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 28 Jun 2018 15:05:38 +0200 Subject: [PATCH] usb: adapt to lx_kit/lx_emul update --- repos/dde_linux/patches/usb_tv64.patch | 13 +++++++++ repos/dde_linux/ports/dde_linux.hash | 2 +- repos/dde_linux/ports/dde_linux.port | 1 + repos/dde_linux/src/lib/usb/dummies.c | 7 ----- repos/dde_linux/src/lib/usb/include/lx_emul.h | 17 ++++-------- repos/dde_linux/src/lib/usb/lx_emul.cc | 27 +++++++++++++------ 6 files changed, 39 insertions(+), 28 deletions(-) create mode 100644 repos/dde_linux/patches/usb_tv64.patch diff --git a/repos/dde_linux/patches/usb_tv64.patch b/repos/dde_linux/patches/usb_tv64.patch new file mode 100644 index 000000000..1bf2b2145 --- /dev/null +++ b/repos/dde_linux/patches/usb_tv64.patch @@ -0,0 +1,13 @@ +diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c +index 424ac5d..a2afc34 100644 +--- a/drivers/usb/host/ehci-timer.c ++++ b/drivers/usb/host/ehci-timer.c +@@ -422,7 +422,7 @@ static enum hrtimer_restart ehci_hrtimer_func(struct hrtimer *t) + */ + now = ktime_get(); + for_each_set_bit(e, &events, EHCI_HRTIMER_NUM_EVENTS) { +- if (now.tv64 >= ehci->hr_timeouts[e].tv64) ++ if (now >= ehci->hr_timeouts[e]) + event_handlers[e](ehci); + else + ehci_enable_event(ehci, e, false); diff --git a/repos/dde_linux/ports/dde_linux.hash b/repos/dde_linux/ports/dde_linux.hash index 04aafbd87..fc80707b5 100644 --- a/repos/dde_linux/ports/dde_linux.hash +++ b/repos/dde_linux/ports/dde_linux.hash @@ -1 +1 @@ -55b39b5a0abadfe7027a5128d9d439d586d7a830 +dbe07ce4380f2028e3b9d5fccaedff6b831b9a0e diff --git a/repos/dde_linux/ports/dde_linux.port b/repos/dde_linux/ports/dde_linux.port index 8c1d317d5..fb066194a 100644 --- a/repos/dde_linux/ports/dde_linux.port +++ b/repos/dde_linux/ports/dde_linux.port @@ -194,6 +194,7 @@ PATCH_OPT(patches/usb_evdev.patch) := $(USB_OPT) PATCH_OPT(patches/usb_mem.patch) := $(USB_OPT) PATCH_OPT(patches/usb_usbnet.patch) := $(USB_OPT) PATCH_OPT(patches/usb_rndis.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_tv64.patch) := $(USB_OPT) # INTEL FB PATCH_OPT(patches/intel_fb_export_api.patch) := -p1 -d$(SRC_DIR_INTEL_FB) diff --git a/repos/dde_linux/src/lib/usb/dummies.c b/repos/dde_linux/src/lib/usb/dummies.c index b320b6451..2510b2509 100644 --- a/repos/dde_linux/src/lib/usb/dummies.c +++ b/repos/dde_linux/src/lib/usb/dummies.c @@ -232,13 +232,6 @@ void cpu_relax(void) { SKIP; } struct task_struct *current; -/****************** - ** linux/wait.h ** - ******************/ - -void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) { TRACE; } - - /********************* ** linux/kthread.h ** *********************/ diff --git a/repos/dde_linux/src/lib/usb/include/lx_emul.h b/repos/dde_linux/src/lib/usb/include/lx_emul.h index c895f941f..c2a3940cb 100644 --- a/repos/dde_linux/src/lib/usb/include/lx_emul.h +++ b/repos/dde_linux/src/lib/usb/include/lx_emul.h @@ -69,13 +69,6 @@ static inline void bt() #include - -/********************* - ** linux/kconfig.h ** - *********************/ - -#define IS_ENABLED(x) x - /***************** ** asm/param.h ** *****************/ @@ -181,8 +174,6 @@ typedef struct { __u8 b[16]; } uuid_le; #include -#define __aligned(N) __attribute__((aligned(N))) - struct __una_u16 { u16 x; } __attribute__((packed)); struct __una_u32 { u32 x; } __attribute__((packed)); struct __una_u64 { u64 x; } __attribute__((packed)); @@ -241,7 +232,6 @@ struct page #include enum { - ENOEXEC = 8, EISDIR = 21, EXFULL = 52, ERESTART = 53, @@ -629,6 +619,9 @@ ktime_t ktime_mono_to_real(ktime_t mono); #include +#define from_timer(var, callback_timer, timer_fieldname) \ + container_of(callback_timer, typeof(*var), timer_fieldname) + /******************* ** linux/delay.h ** @@ -649,9 +642,10 @@ extern unsigned long loops_per_jiffy; /* needed by 'dwc_otg_attr.c' */ #include +#define wait_queue_t wait_queue_entry_t + enum { WORK_STRUCT_PENDING_BIT = 0, - WQ_FREEZABLE = (1 << 2), }; @@ -1516,7 +1510,6 @@ int seq_putc(struct seq_file *, char); enum { GFP_NOIO = GFP_LX_DMA, - GFP_NOWAIT = 0x2000000u, }; unsigned long get_zeroed_page(gfp_t gfp_mask); diff --git a/repos/dde_linux/src/lib/usb/lx_emul.cc b/repos/dde_linux/src/lib/usb/lx_emul.cc index ec7cf0659..94f749ed9 100644 --- a/repos/dde_linux/src/lib/usb/lx_emul.cc +++ b/repos/dde_linux/src/lib/usb/lx_emul.cc @@ -741,11 +741,6 @@ void *sg_virt(struct scatterlist *sg) ** linux/ioport.h ** ********************/ -resource_size_t resource_size(const struct resource *res) -{ - return res->end - res->start + 1; -} - struct resource * devm_request_mem_region(struct device *dev, resource_size_t start, resource_size_t n, const char *name) { @@ -989,9 +984,9 @@ signed long schedule_timeout_uninterruptible(signed long timeout) #include -static void _completion_timeout(unsigned long t) +static void _completion_timeout(struct timer_list *t) { - Lx::Task *task = (Lx::Task *)t; + Lx::Task *task = (Lx::Task *)t->data; task->unblock(); } @@ -1002,7 +997,8 @@ long __wait_completion(struct completion *work, unsigned long timeout) unsigned long j = timeout ? jiffies + timeout : 0; if (timeout) { - setup_timer(&t, _completion_timeout, (unsigned long)Lx::scheduler().current()); + timer_setup(&t, _completion_timeout, 0u); + t.data = (unsigned long)Lx::scheduler().current(); mod_timer(&t, timeout); } @@ -1120,3 +1116,18 @@ int hex2bin(u8 *dst, const char *src, size_t count) } return 0; } + + +/******************* + ** linux/timer.h ** + *******************/ + +extern "C" void init_timer(struct timer_list *) { } + + +extern "C" void setup_timer(struct timer_list *timer, void (*function)(unsigned long), + unsigned long data) +{ + timer_setup(timer, function, 0u); + timer->data = data; +}