diff options
author | Jordan Crouse <jcrouse@codeaurora.org> | 2016-01-25 16:01:58 -0700 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:18:41 -0700 |
commit | da324cf8f6ee36e5da13d543927ab6e077fb6531 (patch) | |
tree | 36726140fa3ce772660635dfcde66d49dca5021f /drivers/gpu/msm/adreno_sysfs.c | |
parent | 11d4029da91508ea4bc4ca66ea5bd3c333ef591b (diff) |
msm: kgsl: Add and use KGSL_DEVICE macro
Add a helper macro to convert an adreno_device pointer to a
struct kgsl_device pointer. This is mostly syntatic sugar
but it makes the code a bit cleaner and it abstracts a bit of
the ugliness away.
Change-Id: Ic0dedbadd97bda3316a58514a5a64757bd4154c7
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Diffstat (limited to 'drivers/gpu/msm/adreno_sysfs.c')
-rw-r--r-- | drivers/gpu/msm/adreno_sysfs.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/gpu/msm/adreno_sysfs.c b/drivers/gpu/msm/adreno_sysfs.c index 4c082fc2850e..977ba7624d3f 100644 --- a/drivers/gpu/msm/adreno_sysfs.c +++ b/drivers/gpu/msm/adreno_sysfs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -53,7 +53,7 @@ static unsigned int _ft_policy_show(struct adreno_device *adreno_dev) static int _ft_pagefault_policy_store(struct adreno_device *adreno_dev, unsigned int val) { - struct kgsl_device *device = &adreno_dev->dev; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret = 0; mutex_lock(&device->mutex); @@ -79,7 +79,7 @@ static unsigned int _ft_pagefault_policy_show(struct adreno_device *adreno_dev) static int _ft_fast_hang_detect_store(struct adreno_device *adreno_dev, unsigned int val) { - struct kgsl_device *device = &adreno_dev->dev; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); if (!test_bit(ADRENO_DEVICE_SOFT_FAULT_DETECT, &adreno_dev->priv)) return 0; @@ -119,7 +119,7 @@ static unsigned int _ft_long_ib_detect_show(struct adreno_device *adreno_dev) static int _ft_hang_intr_status_store(struct adreno_device *adreno_dev, unsigned int val) { - struct kgsl_device *device = &adreno_dev->dev; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret = 0; if (val == test_bit(ADRENO_DEVICE_HANG_INTR, &adreno_dev->priv)) @@ -148,7 +148,7 @@ static unsigned int _ft_hang_intr_status_show(struct adreno_device *adreno_dev) static int _pwrctrl_store(struct adreno_device *adreno_dev, unsigned int val, unsigned int flag) { - struct kgsl_device *device = &adreno_dev->dev; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); if (val == test_bit(flag, &adreno_dev->pwrctrl_flag)) return 0; @@ -168,7 +168,7 @@ static int _pwrctrl_store(struct adreno_device *adreno_dev, static int _preemption_store(struct adreno_device *adreno_dev, unsigned int val) { - struct kgsl_device *device = &adreno_dev->dev; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); if (test_bit(ADRENO_DEVICE_PREEMPTION, &adreno_dev->priv) == val) return 0; @@ -414,9 +414,9 @@ static struct kobj_type ktype_ppd = { .sysfs_ops = &ppd_sysfs_ops, }; -static void ppd_sysfs_close(struct kgsl_device *device) +static void ppd_sysfs_close(struct adreno_device *adreno_dev) { - struct adreno_device *adreno_dev = ADRENO_DEVICE(device); + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); if (!ADRENO_FEATURE(adreno_dev, ADRENO_PPD)) return; @@ -425,10 +425,10 @@ static void ppd_sysfs_close(struct kgsl_device *device) kobject_put(&device->ppd_kobj); } -static int ppd_sysfs_init(struct kgsl_device *device) +static int ppd_sysfs_init(struct adreno_device *adreno_dev) { + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret; - struct adreno_device *adreno_dev = ADRENO_DEVICE(device); if (!ADRENO_FEATURE(adreno_dev, ADRENO_PPD)) return -ENODEV; @@ -444,31 +444,35 @@ static int ppd_sysfs_init(struct kgsl_device *device) /** * adreno_sysfs_close() - Take down the adreno sysfs files - * @device: Pointer to the KGSL device + * @adreno_dev: Pointer to the adreno device * * Take down the sysfs files on when the device goes away */ -void adreno_sysfs_close(struct kgsl_device *device) +void adreno_sysfs_close(struct adreno_device *adreno_dev) { - ppd_sysfs_close(device); + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); + + ppd_sysfs_close(adreno_dev); kgsl_remove_device_sysfs_files(device->dev, _attr_list); } /** * adreno_sysfs_init() - Initialize adreno sysfs files - * @device: Pointer to the KGSL device + * @adreno_dev: Pointer to the adreno device * * Initialize many of the adreno specific sysfs files especially for fault * tolerance and power control */ -int adreno_sysfs_init(struct kgsl_device *device) +int adreno_sysfs_init(struct adreno_device *adreno_dev) { - int ret = kgsl_create_device_sysfs_files(device->dev, _attr_list); - if (ret != 0) - return ret; + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); + int ret; + + ret = kgsl_create_device_sysfs_files(device->dev, _attr_list); /* Add the PPD directory and files */ - ppd_sysfs_init(device); + if (ret == 0) + ppd_sysfs_init(adreno_dev); return 0; } |