diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 10:13:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 10:13:36 -0800 |
commit | 39272dde8ffcfd1322209e05f3f8fa4d14f796de (patch) | |
tree | 1c06907119d0ae484319379ec4404edf95ac37b5 /drivers/staging/android | |
parent | 67ad058d97b8cff441211b791d97e5f776b81210 (diff) | |
parent | 841e3ed977e0284e3680d6345d880a64e8072573 (diff) | |
download | blackbird-obmc-linux-39272dde8ffcfd1322209e05f3f8fa4d14f796de.tar.gz blackbird-obmc-linux-39272dde8ffcfd1322209e05f3f8fa4d14f796de.zip |
Merge tag 'staging-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here is the big staging driver pull request for 4.5-rc1.
Lots of cleanups and fixes here, not as many as some releases, but
800+ isn't that bad. Full details in the shortlog. All of these have
been in linux-next for a while"
* tag 'staging-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (843 commits)
Revert "arm64: dts: Add dts files to enable ION on Hi6220 SoC."
staging: gdm724x: constify tty_port_operations structs
staging: gdm72xx: add userspace data struct
staging: gdm72xx: Replace timeval with ktime_t
iio: adc: ina2xx: Fix incorrect report of data endianness to userspace.
iio: light: us5182d: Refactor read_raw function
iio: light: us5182d: Add interrupt support and events
iio: light: us5182d: Fix enable status inconcistency
iio: Make IIO value formating function globally available.
staging: emxx_udc: use list_first_entry_or_null()
staging/emxx_udc: fix 64-bit warnings
STAGING: COMEDI: Using kernel types in plx9080.h
STAGING: COMEDI: Added spaces around binary operators in plx9080.h
STAGING: COMEDI: Fixed format of comments in plx9080.h
staging: comedi: comedilib.h: Coding style warning fix for block comments
staging: comedi: s526: add macros for counter control reg values
staging: comedi: s526: replace counter mode bitfield struct
staging: comedi: check for more errors for zero-length write
staging: comedi: simplify returned errors for comedi_write()
staging: comedi: return error on "write" if no command set up
...
Diffstat (limited to 'drivers/staging/android')
-rw-r--r-- | drivers/staging/android/TODO | 8 | ||||
-rw-r--r-- | drivers/staging/android/ashmem.c | 15 | ||||
-rw-r--r-- | drivers/staging/android/ion/Kconfig | 7 | ||||
-rw-r--r-- | drivers/staging/android/ion/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/android/ion/compat_ion.c | 6 | ||||
-rw-r--r-- | drivers/staging/android/ion/hisilicon/Kconfig | 5 | ||||
-rw-r--r-- | drivers/staging/android/ion/hisilicon/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/android/ion/hisilicon/hi6220_ion.c | 223 | ||||
-rw-r--r-- | drivers/staging/android/lowmemorykiller.c | 6 | ||||
-rw-r--r-- | drivers/staging/android/sync.c | 41 | ||||
-rw-r--r-- | drivers/staging/android/sync.h | 10 | ||||
-rw-r--r-- | drivers/staging/android/sync_debug.c | 42 | ||||
-rw-r--r-- | drivers/staging/android/timed_gpio.c | 11 |
13 files changed, 321 insertions, 55 deletions
diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO index 8f3ac37bfe12..64d8c8720960 100644 --- a/drivers/staging/android/TODO +++ b/drivers/staging/android/TODO @@ -25,5 +25,13 @@ ion/ exposes existing cma regions and doesn't reserve unecessarily memory when booting a system which doesn't use ion. +sync framework: + - remove CONFIG_SW_SYNC_USER, it is used only for testing/debugging and + should not be upstreamed. + - port CONFIG_SW_SYNC_USER tests interfaces to use debugfs somehow + - port libsync tests to kselftest + - clean up and ABI check for security issues + - move it to drivers/base/dma-buf + Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc: Arve Hjønnevåg <arve@android.com> and Riley Andrews <riandrews@android.com> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 3f2a3d611e4b..5bb1283d19cd 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -831,14 +831,14 @@ static struct miscdevice ashmem_misc = { static int __init ashmem_init(void) { - int ret; + int ret = -ENOMEM; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", sizeof(struct ashmem_area), 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); - return -ENOMEM; + goto out; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", @@ -846,13 +846,13 @@ static int __init ashmem_init(void) 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); - return -ENOMEM; + goto out_free1; } ret = misc_register(&ashmem_misc); if (unlikely(ret)) { pr_err("failed to register misc device!\n"); - return ret; + goto out_free2; } register_shrinker(&ashmem_shrinker); @@ -860,5 +860,12 @@ static int __init ashmem_init(void) pr_info("initialized\n"); return 0; + +out_free2: + kmem_cache_destroy(ashmem_range_cachep); +out_free1: + kmem_cache_destroy(ashmem_area_cachep); +out: + return ret; } device_initcall(ashmem_init); diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig index 345234624492..19c1572f1525 100644 --- a/drivers/staging/android/ion/Kconfig +++ b/drivers/staging/android/ion/Kconfig @@ -33,3 +33,10 @@ config ION_TEGRA help Choose this option if you wish to use ion on an nVidia Tegra. +config ION_HISI + tristate "Ion for Hisilicon" + depends on ARCH_HISI && ION + help + Choose this option if you wish to use ion on Hisilicon Platform. + +source "drivers/staging/android/ion/hisilicon/Kconfig" diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index b56fd2bf2b4f..18cc2aa593c2 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -7,4 +7,5 @@ endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ +obj-$(CONFIG_ION_HISI) += hisilicon/ diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c index a402fdaf54ca..9a978d21785e 100644 --- a/drivers/staging/android/ion/compat_ion.c +++ b/drivers/staging/android/ion/compat_ion.c @@ -137,7 +137,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_allocation_data(data32, data); @@ -156,7 +156,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_handle_data(data32, data); @@ -173,7 +173,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_custom_data(data32, data); diff --git a/drivers/staging/android/ion/hisilicon/Kconfig b/drivers/staging/android/ion/hisilicon/Kconfig new file mode 100644 index 000000000000..2b4bd0798290 --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/Kconfig @@ -0,0 +1,5 @@ +config HI6220_ION + bool "Hi6220 ION Driver" + depends on ARCH_HISI && ION + help + Build the Hisilicon Hi6220 ion driver. diff --git a/drivers/staging/android/ion/hisilicon/Makefile b/drivers/staging/android/ion/hisilicon/Makefile new file mode 100644 index 000000000000..2a89414280ac --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_HI6220_ION) += hi6220_ion.o diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c new file mode 100644 index 000000000000..e3c07b2ba00e --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c @@ -0,0 +1,223 @@ +/* + * Hisilicon Hi6220 ION Driver + * + * Copyright (c) 2015 Hisilicon Limited. + * + * Author: Chen Feng <puck.chen@hisilicon.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define pr_fmt(fmt) "Ion: " fmt + +#include <linux/err.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/of.h> +#include <linux/mm.h> +#include "../ion_priv.h" +#include "../ion.h" + +struct hi6220_ion_type_table { + const char *name; + enum ion_heap_type type; +}; + +static struct hi6220_ion_type_table ion_type_table[] = { + {"ion_system", ION_HEAP_TYPE_SYSTEM}, + {"ion_system_contig", ION_HEAP_TYPE_SYSTEM_CONTIG}, + {"ion_carveout", ION_HEAP_TYPE_CARVEOUT}, + {"ion_chunk", ION_HEAP_TYPE_CHUNK}, + {"ion_dma", ION_HEAP_TYPE_DMA}, + {"ion_custom", ION_HEAP_TYPE_CUSTOM}, +}; + +static struct ion_device *idev; +static int num_heaps; +static struct ion_heap **heaps; +static struct ion_platform_heap **heaps_data; + +static int get_type_by_name(const char *name, enum ion_heap_type *type) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ion_type_table); i++) { + if (strncmp(name, ion_type_table[i].name, strlen(name))) + continue; + + *type = ion_type_table[i].type; + return 0; + } + + return -EINVAL; +} + +static int hi6220_set_platform_data(struct platform_device *pdev) +{ + unsigned int base; + unsigned int size; + unsigned int id; + const char *heap_name; + const char *type_name; + enum ion_heap_type type; + int ret; + struct device_node *np; + struct ion_platform_heap *p_data; + const struct device_node *dt_node = pdev->dev.of_node; + int index = 0; + + for_each_child_of_node(dt_node, np) + num_heaps++; + + heaps_data = devm_kzalloc(&pdev->dev, + sizeof(struct ion_platform_heap *) * + num_heaps, + GFP_KERNEL); + if (!heaps_data) + return -ENOMEM; + + for_each_child_of_node(dt_node, np) { + ret = of_property_read_string(np, "heap-name", &heap_name); + if (ret < 0) { + pr_err("check the name of node %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-id", &id); + if (ret < 0) { + pr_err("check the id %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-base", &base); + if (ret < 0) { + pr_err("check the base of node %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-size", &size); + if (ret < 0) { + pr_err("check the size of node %s\n", np->name); + continue; + } + + ret = of_property_read_string(np, "heap-type", &type_name); + if (ret < 0) { + pr_err("check the type of node %s\n", np->name); + continue; + } + + ret = get_type_by_name(type_name, &type); + if (ret < 0) { + pr_err("type name error %s!\n", type_name); + continue; + } + pr_info("heap index %d : name %s base 0x%x size 0x%x id %d type %d\n", + index, heap_name, base, size, id, type); + + p_data = devm_kzalloc(&pdev->dev, + sizeof(struct ion_platform_heap), + GFP_KERNEL); + if (!p_data) + return -ENOMEM; + + p_data->name = heap_name; + p_data->base = base; + p_data->size = size; + p_data->id = id; + p_data->type = type; + + heaps_data[index] = p_data; + index++; + } + return 0; +} + +static int hi6220_ion_probe(struct platform_device *pdev) +{ + int i; + int err; + static struct ion_platform_heap *p_heap; + + idev = ion_device_create(NULL); + err = hi6220_set_platform_data(pdev); + if (err) { + pr_err("ion set platform data error!\n"); + goto err_free_idev; + } + heaps = devm_kzalloc(&pdev->dev, + sizeof(struct ion_heap *) * num_heaps, + GFP_KERNEL); + if (!heaps) { + err = -ENOMEM; + goto err_free_idev; + } + + /* + * create the heaps as specified in the dts file + */ + for (i = 0; i < num_heaps; i++) { + p_heap = heaps_data[i]; + heaps[i] = ion_heap_create(p_heap); + if (IS_ERR_OR_NULL(heaps[i])) { + err = PTR_ERR(heaps[i]); + goto err_free_heaps; + } + + ion_device_add_heap(idev, heaps[i]); + + pr_info("%s: adding heap %s of type %d with %lx@%lx\n", + __func__, p_heap->name, p_heap->type, + p_heap->base, (unsigned long)p_heap->size); + } + return err; + +err_free_heaps: + for (i = 0; i < num_heaps; ++i) { + ion_heap_destroy(heaps[i]); + heaps[i] = NULL; + } +err_free_idev: + ion_device_destroy(idev); + + return err; +} + +static int hi6220_ion_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < num_heaps; i++) { + ion_heap_destroy(heaps[i]); + heaps[i] = NULL; + } + ion_device_destroy(idev); + + return 0; +} + +static const struct of_device_id hi6220_ion_match_table[] = { + {.compatible = "hisilicon,hi6220-ion"}, + {}, +}; + +static struct platform_driver hi6220_ion_driver = { + .probe = hi6220_ion_probe, + .remove = hi6220_ion_remove, + .driver = { + .name = "ion-hi6220", + .of_match_table = hi6220_ion_match_table, + }, +}; + +static int __init hi6220_ion_init(void) +{ + int ret; + + ret = platform_driver_register(&hi6220_ion_driver); + return ret; +} + +subsys_initcall(hi6220_ion_init); diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index e679d8432810..8b5a4a82d8b8 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -43,7 +43,7 @@ #include <linux/profile.h> #include <linux/notifier.h> -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, @@ -105,8 +105,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n", - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); + sc->nr_to_scan, sc->gfp_mask, other_free, + other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n", diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c78051..ed43796b5b58 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(&obj->kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(&obj->child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence->file = anon_inode_getfile("sync_fence", &sync_fence_fops, @@ -188,34 +188,39 @@ static void fence_check_cb_func(struct fence *f, struct fence_cb *cb) } /* TODO: implement a create which takes more that one sync_pt */ -struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt) { struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence->num_fences = 1; atomic_set(&fence->status, 1); - fence->cbs[0].sync_pt = &pt->base; + fence->cbs[0].sync_pt = pt; fence->cbs[0].fence = fence; - if (fence_add_callback(&pt->base, &fence->cbs[0].cb, - fence_check_cb_func)) + if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func)) atomic_dec(&fence->status); sync_fence_debug_add(fence); return fence; } +EXPORT_SYMBOL(sync_fence_create_dma); + +struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) +{ + return sync_fence_create_dma(name, &pt->base); +} EXPORT_SYMBOL(sync_fence_create); struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file->f_op != &sync_fence_fops) @@ -262,7 +267,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(&fence->status, num_fences); @@ -313,7 +318,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, - int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +358,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, - struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; @@ -519,12 +524,10 @@ static const struct fence_ops android_fence_ops = { static void sync_fence_free(struct kref *kref) { struct sync_fence *fence = container_of(kref, struct sync_fence, kref); - int i, status = atomic_read(&fence->status); + int i; for (i = 0; i < fence->num_fences; ++i) { - if (status) - fence_remove_callback(fence->cbs[i].sync_pt, - &fence->cbs[i].cb); + fence_remove_callback(fence->cbs[i].sync_pt, &fence->cbs[i].cb); fence_put(fence->cbs[i].sync_pt); } @@ -583,14 +586,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +669,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data->name, fence->name, sizeof(data->name)); diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3aede96..afa0752275a7 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -254,6 +254,16 @@ void sync_pt_free(struct sync_pt *pt); */ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); +/** + * sync_fence_create_dma() - creates a sync fence from dma-fence + * @name: name of fence to create + * @pt: dma-fence to add to the fence + * + * Creates a fence containg @pt. Once this is called, the fence takes + * ownership of @pt. + */ +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); + /* * API for sync_fence consumers */ diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index 91ed2c4cff45..f45d13cdd42b 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -82,36 +82,42 @@ static const char *sync_status_str(int status) return "error"; } -static void sync_print_pt(struct seq_file *s, struct sync_pt *pt, bool fence) +static void sync_print_pt(struct seq_file *s, struct fence *pt, bool fence) { int status = 1; - struct sync_timeline *parent = sync_pt_parent(pt); - if (fence_is_signaled_locked(&pt->base)) - status = pt->base.status; + if (fence_is_signaled_locked(pt)) + status = pt->status; seq_printf(s, " %s%spt %s", - fence ? parent->name : "", + fence && pt->ops->get_timeline_name ? + pt->ops->get_timeline_name(pt) : "", fence ? "_" : "", sync_status_str(status)); if (status <= 0) { struct timespec64 ts64 = - ktime_to_timespec64(pt->base.timestamp); + ktime_to_timespec64(pt->timestamp); seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec); } - if (parent->ops->timeline_value_str && - parent->ops->pt_value_str) { + if ((!fence || pt->ops->timeline_value_str) && + pt->ops->fence_value_str) { char value[64]; + bool success; - parent->ops->pt_value_str(pt, value, sizeof(value)); - seq_printf(s, ": %s", value); - if (fence) { - parent->ops->timeline_value_str(parent, value, - sizeof(value)); - seq_printf(s, " / %s", value); + pt->ops->fence_value_str(pt, value, sizeof(value)); + success = strlen(value); + + if (success) + seq_printf(s, ": %s", value); + + if (success && fence) { + pt->ops->timeline_value_str(pt, value, sizeof(value)); + + if (strlen(value)) + seq_printf(s, " / %s", value); } } @@ -138,7 +144,7 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) list_for_each(pos, &obj->child_list_head) { struct sync_pt *pt = container_of(pos, struct sync_pt, child_list); - sync_print_pt(s, pt, false); + sync_print_pt(s, &pt->base, false); } spin_unlock_irqrestore(&obj->child_list_lock, flags); } @@ -153,11 +159,7 @@ static void sync_print_fence(struct seq_file *s, struct sync_fence *fence) sync_status_str(atomic_read(&fence->status))); for (i = 0; i < fence->num_fences; ++i) { - struct sync_pt *pt = - container_of(fence->cbs[i].sync_pt, - struct sync_pt, base); - - sync_print_pt(s, pt, true); + sync_print_pt(s, fence->cbs[i].sync_pt, true); } spin_lock_irqsave(&fence->wq.lock, flags); diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726f1a6c..bcd9924d4631 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,7 +25,6 @@ #include "timed_output.h" #include "timed_gpio.h" - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; @@ -76,8 +75,8 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout; hrtimer_start(&data->timer, - ktime_set(value / 1000, (value % 1000) * 1000000), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * 1000000), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(&data->lock, flags); @@ -94,8 +93,8 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(&pdev->dev, - sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); + sizeof(*gpio_data) * pdata->num_gpios, + GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +103,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = &gpio_data[i]; hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); + HRTIMER_MODE_REL); gpio_dat->timer.function = gpio_timer_func; spin_lock_init(&gpio_dat->lock); |