[PATCH 6/8] staging: gasket: remove "reset type" param from framework

From: Todd Poynor
Date: Thu Aug 02 2018 - 12:03:02 EST


From: Todd Poynor <toddpoynor@xxxxxxxxxx>

The "type of reset" parameter to the gasket device reset APIs isn't
required by the only gasket device submitted upstream, apex.

The framework documents the param as private to the device driver and a
pass-through at the gasket layer, but the gasket core calls the device
driver with a hardcoded reset type of zero, which is not documented as
having a predefined meaning.

In light of all this, remove the reset type parameter from the
framework. Remove the reset ioctl reset type parameter, and bump the
framework version number to reflect the interface change.

Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
---
drivers/staging/gasket/gasket.h | 4 ++--
drivers/staging/gasket/gasket_constants.h | 2 +-
drivers/staging/gasket/gasket_core.c | 11 +++++------
drivers/staging/gasket/gasket_core.h | 13 +++----------
drivers/staging/gasket/gasket_ioctl.c | 3 +--
5 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/gasket/gasket.h b/drivers/staging/gasket/gasket.h
index 9f709f0c5a2bb..a0f065c517a52 100644
--- a/drivers/staging/gasket/gasket.h
+++ b/drivers/staging/gasket/gasket.h
@@ -52,8 +52,8 @@ struct gasket_coherent_alloc_config_ioctl {
/* Base number for all Gasket-common IOCTLs */
#define GASKET_IOCTL_BASE 0xDC

-/* Reset the device using the specified reset type. */
-#define GASKET_IOCTL_RESET _IOW(GASKET_IOCTL_BASE, 0, unsigned long)
+/* Reset the device. */
+#define GASKET_IOCTL_RESET _IO(GASKET_IOCTL_BASE, 0)

/* Associate the specified [event]fd with the specified interrupt. */
#define GASKET_IOCTL_SET_EVENTFD \
diff --git a/drivers/staging/gasket/gasket_constants.h b/drivers/staging/gasket/gasket_constants.h
index 82ed3f21e8aed..50d87c7b178c2 100644
--- a/drivers/staging/gasket/gasket_constants.h
+++ b/drivers/staging/gasket/gasket_constants.h
@@ -3,7 +3,7 @@
#ifndef __GASKET_CONSTANTS_H__
#define __GASKET_CONSTANTS_H__

-#define GASKET_FRAMEWORK_VERSION "1.1.1"
+#define GASKET_FRAMEWORK_VERSION "1.1.2"

/*
* The maximum number of simultaneous device types supported by the framework.
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 19331feb9b09f..99994e30b154b 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1295,7 +1295,7 @@ static int gasket_release(struct inode *inode, struct file *file)
ownership->owner = 0;

/* Forces chip reset before we unmap the page tables. */
- driver_desc->device_reset_cb(gasket_dev, 0);
+ driver_desc->device_reset_cb(gasket_dev);

for (i = 0; i < driver_desc->num_page_tables; ++i) {
gasket_page_table_unmap_all(gasket_dev->page_table[i]);
@@ -1623,18 +1623,18 @@ const char *gasket_num_name_lookup(uint num,
}
EXPORT_SYMBOL(gasket_num_name_lookup);

-int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type)
+int gasket_reset(struct gasket_dev *gasket_dev)
{
int ret;

mutex_lock(&gasket_dev->mutex);
- ret = gasket_reset_nolock(gasket_dev, reset_type);
+ ret = gasket_reset_nolock(gasket_dev);
mutex_unlock(&gasket_dev->mutex);
return ret;
}
EXPORT_SYMBOL(gasket_reset);

-int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type)
+int gasket_reset_nolock(struct gasket_dev *gasket_dev)
{
int ret;
int i;
@@ -1644,8 +1644,7 @@ int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type)
if (!driver_desc->device_reset_cb)
return 0;

- /* Perform a device reset of the requested type. */
- ret = driver_desc->device_reset_cb(gasket_dev, reset_type);
+ ret = driver_desc->device_reset_cb(gasket_dev);
if (ret) {
dev_dbg(gasket_dev->dev, "Device reset cb returned %d.\n",
ret);
diff --git a/drivers/staging/gasket/gasket_core.h b/drivers/staging/gasket/gasket_core.h
index 713bf42de41a4..67f5960943a8a 100644
--- a/drivers/staging/gasket/gasket_core.h
+++ b/drivers/staging/gasket/gasket_core.h
@@ -580,17 +580,12 @@ struct gasket_driver_desc {
/*
* device_reset_cb: Reset the hardware in question.
* @dev: Pointer to the gasket_dev structure for this device.
- * @type: Integer representing reset type. (All
- * Gasket resets have an integer representing their type
- * defined in (device)_ioctl.h; the specific resets are
- * device-dependent, but are handled in the device-specific
- * callback anyways.)
*
* Called by reset ioctls. This function should not
* lock the gasket_dev mutex. It should return 0 on success
* and an error on failure.
*/
- int (*device_reset_cb)(struct gasket_dev *dev, uint reset_type);
+ int (*device_reset_cb)(struct gasket_dev *dev);
};

/*
@@ -615,15 +610,13 @@ void gasket_unregister_device(const struct gasket_driver_desc *desc);
/*
* Reset the Gasket device.
* @gasket_dev: Gasket device struct.
- * @reset_type: Uint representing requested reset type. Should be
- * valid in the underlying callback.
*
* Calls device_reset_cb. Returns 0 on success and an error code othewrise.
* gasket_reset_nolock will not lock the mutex, gasket_reset will.
*
*/
-int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type);
-int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type);
+int gasket_reset(struct gasket_dev *gasket_dev);
+int gasket_reset_nolock(struct gasket_dev *gasket_dev);

/*
* Memory management functions. These will likely be spun off into their own
diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c
index d3397cc74e69f..0ca48e688818f 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -304,8 +304,7 @@ long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp)
*/
switch (cmd) {
case GASKET_IOCTL_RESET:
- trace_gasket_ioctl_integer_data(arg);
- retval = gasket_reset(gasket_dev, arg);
+ retval = gasket_reset(gasket_dev);
break;
case GASKET_IOCTL_SET_EVENTFD:
retval = gasket_set_event_fd(gasket_dev, argp);
--
2.18.0.597.ga71716f1ad-goog