Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac2b96f3 authored by Harald Freudenberger's avatar Harald Freudenberger Committed by Martin Schwidefsky
Browse files

s390/zcrypt: code beautify



Code beautify by following most of the checkpatch suggestions:
 - SPDX license identifier line complains by checkpatch
 - missing space or newline complains by checkpatch
 - octal numbers for permssions complains by checkpatch
 - renaming of static sysfs functions complains by checkpatch
 - fix of block comment complains by checkpatch
 - fix printf like calls where function name instead of %s __func__
   was used
 - __packed instead of __attribute__((packed))
 - init to zero for static variables removed
 - use of DEVICE_ATTR_RO and DEVICE_ATTR_RW macros

No functional code changes or API changes!

Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 9b97e9f5
Loading
Loading
Loading
Loading
+36 −36
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ struct zcrypt_device_matrix_ext {
	struct zcrypt_device_status_ext device[MAX_ZDEV_ENTRIES_EXT];
};

#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
#define AUTOSELECT 0xFFFFFFFF

#define ZCRYPT_IOCTL_MAGIC 'z'

+38 −35
Original line number Diff line number Diff line
@@ -43,12 +43,12 @@
 */
int ap_domain_index = -1;	/* Adjunct Processor Domain Index */
static DEFINE_SPINLOCK(ap_domain_lock);
module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP);
module_param_named(domain, ap_domain_index, int, 0440);
MODULE_PARM_DESC(domain, "domain index for ap devices");
EXPORT_SYMBOL(ap_domain_index);

static int ap_thread_flag = 0;
module_param_named(poll_thread, ap_thread_flag, int, S_IRUSR|S_IRGRP);
static int ap_thread_flag;
module_param_named(poll_thread, ap_thread_flag, int, 0440);
MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off).");

static struct device *ap_root_device;
@@ -78,22 +78,26 @@ static DECLARE_WORK(ap_scan_work, ap_scan_bus);
static void ap_tasklet_fn(unsigned long);
static DECLARE_TASKLET(ap_tasklet, ap_tasklet_fn, 0);
static DECLARE_WAIT_QUEUE_HEAD(ap_poll_wait);
static struct task_struct *ap_poll_kthread = NULL;
static struct task_struct *ap_poll_kthread;
static DEFINE_MUTEX(ap_poll_thread_mutex);
static DEFINE_SPINLOCK(ap_poll_timer_lock);
static struct hrtimer ap_poll_timer;
/* In LPAR poll with 4kHz frequency. Poll every 250000 nanoseconds.
 * If z/VM change to 1500000 nanoseconds to adjust to z/VM polling.*/
/*
 * In LPAR poll with 4kHz frequency. Poll every 250000 nanoseconds.
 * If z/VM change to 1500000 nanoseconds to adjust to z/VM polling.
 */
static unsigned long long poll_timeout = 250000;

/* Suspend flag */
static int ap_suspend_flag;
/* Maximum domain id */
static int ap_max_domain_id;
/* Flag to check if domain was set through module parameter domain=. This is
/*
 * Flag to check if domain was set through module parameter domain=. This is
 * important when supsend and resume is done in a z/VM environment where the
 * domain might change. */
static int user_set_domain = 0;
 * domain might change.
 */
static int user_set_domain;
static struct bus_type ap_bus_type;

/* Adapter interrupt definitions */
@@ -570,7 +574,7 @@ static int ap_dev_resume(struct device *dev)

static void ap_bus_suspend(void)
{
	AP_DBF(DBF_DEBUG, "ap_bus_suspend running\n");
	AP_DBF(DBF_DEBUG, "%s running\n", __func__);

	ap_suspend_flag = 1;
	/*
@@ -607,7 +611,7 @@ static void ap_bus_resume(void)
{
	int rc;

	AP_DBF(DBF_DEBUG, "ap_bus_resume running\n");
	AP_DBF(DBF_DEBUG, "%s running\n", __func__);

	/* remove all queue devices */
	bus_for_each_dev(&ap_bus_type, NULL, NULL,
@@ -775,7 +779,7 @@ static ssize_t ap_domain_store(struct bus_type *bus,
	return count;
}

static BUS_ATTR(ap_domain, 0644, ap_domain_show, ap_domain_store);
static BUS_ATTR_RW(ap_domain);

static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
{
@@ -790,8 +794,7 @@ static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
			ap_configuration->adm[6], ap_configuration->adm[7]);
}

static BUS_ATTR(ap_control_domain_mask, 0444,
		ap_control_domain_mask_show, NULL);
static BUS_ATTR_RO(ap_control_domain_mask);

static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf)
{
@@ -806,13 +809,7 @@ static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf)
			ap_configuration->aqm[6], ap_configuration->aqm[7]);
}

static BUS_ATTR(ap_usage_domain_mask, 0444,
		ap_usage_domain_mask_show, NULL);

static ssize_t ap_config_time_show(struct bus_type *bus, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", ap_config_time);
}
static BUS_ATTR_RO(ap_usage_domain_mask);

static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
{
@@ -820,9 +817,14 @@ static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
			ap_using_interrupts() ? 1 : 0);
}

static BUS_ATTR(ap_interrupts, 0444, ap_interrupts_show, NULL);
static BUS_ATTR_RO(ap_interrupts);

static ssize_t config_time_show(struct bus_type *bus, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", ap_config_time);
}

static ssize_t ap_config_time_store(struct bus_type *bus,
static ssize_t config_time_store(struct bus_type *bus,
				 const char *buf, size_t count)
{
	int time;
@@ -834,14 +836,14 @@ static ssize_t ap_config_time_store(struct bus_type *bus,
	return count;
}

static BUS_ATTR(config_time, 0644, ap_config_time_show, ap_config_time_store);
static BUS_ATTR_RW(config_time);

static ssize_t ap_poll_thread_show(struct bus_type *bus, char *buf)
static ssize_t poll_thread_show(struct bus_type *bus, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", ap_poll_kthread ? 1 : 0);
}

static ssize_t ap_poll_thread_store(struct bus_type *bus,
static ssize_t poll_thread_store(struct bus_type *bus,
				 const char *buf, size_t count)
{
	int flag, rc;
@@ -857,7 +859,7 @@ static ssize_t ap_poll_thread_store(struct bus_type *bus,
	return count;
}

static BUS_ATTR(poll_thread, 0644, ap_poll_thread_show, ap_poll_thread_store);
static BUS_ATTR_RW(poll_thread);

static ssize_t poll_timeout_show(struct bus_type *bus, char *buf)
{
@@ -886,7 +888,7 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
	return count;
}

static BUS_ATTR(poll_timeout, 0644, poll_timeout_show, poll_timeout_store);
static BUS_ATTR_RW(poll_timeout);

static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf)
{
@@ -899,7 +901,7 @@ static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf)
	return snprintf(buf, PAGE_SIZE, "%d\n", max_domain_id);
}

static BUS_ATTR(ap_max_domain_id, 0444, ap_max_domain_id_show, NULL);
static BUS_ATTR_RO(ap_max_domain_id);

static struct bus_attribute *const ap_bus_attrs[] = {
	&bus_attr_ap_domain,
@@ -1038,7 +1040,7 @@ static void ap_scan_bus(struct work_struct *unused)
	unsigned int func = 0;
	int rc, id, dom, borked, domains, defdomdevs = 0;

	AP_DBF(DBF_DEBUG, "ap_scan_bus running\n");
	AP_DBF(DBF_DEBUG, "%s running\n", __func__);

	ap_query_configuration(ap_configuration);
	if (ap_select_domain() != 0)
@@ -1163,7 +1165,8 @@ static void ap_scan_bus(struct work_struct *unused)
	} /* end device loop */

	if (defdomdevs < 1)
		AP_DBF(DBF_INFO, "no queue device with default domain %d available\n",
		AP_DBF(DBF_INFO,
		       "no queue device with default domain %d available\n",
		       ap_domain_index);

out:
+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0+
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright IBM Corp. 2006, 2012
 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
@@ -167,7 +167,7 @@ struct ap_queue {
	int pendingq_count;		/* # requests on pendingq list. */
	int requestq_count;		/* # requests on requestq list. */
	int total_request_count;	/* # requests ever for this AP device.*/
	int request_timeout;		/* Request timout in jiffies. */
	int request_timeout;		/* Request timeout in jiffies. */
	struct timer_list timeout;	/* Timer for request timeouts. */
	struct list_head pendingq;	/* List of message sent to AP queue. */
	struct list_head requestq;	/* List of message yet to be sent. */
+25 −25
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
/*
 * AP card related attributes.
 */
static ssize_t ap_hwtype_show(struct device *dev,
static ssize_t hwtype_show(struct device *dev,
			   struct device_attribute *attr, char *buf)
{
	struct ap_card *ac = to_ap_card(dev);
@@ -26,9 +26,9 @@ static ssize_t ap_hwtype_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", ac->ap_dev.device_type);
}

static DEVICE_ATTR(hwtype, 0444, ap_hwtype_show, NULL);
static DEVICE_ATTR_RO(hwtype);

static ssize_t ap_raw_hwtype_show(struct device *dev,
static ssize_t raw_hwtype_show(struct device *dev,
			       struct device_attribute *attr, char *buf)
{
	struct ap_card *ac = to_ap_card(dev);
@@ -36,9 +36,9 @@ static ssize_t ap_raw_hwtype_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", ac->raw_hwtype);
}

static DEVICE_ATTR(raw_hwtype, 0444, ap_raw_hwtype_show, NULL);
static DEVICE_ATTR_RO(raw_hwtype);

static ssize_t ap_depth_show(struct device *dev, struct device_attribute *attr,
static ssize_t depth_show(struct device *dev, struct device_attribute *attr,
			  char *buf)
{
	struct ap_card *ac = to_ap_card(dev);
@@ -46,7 +46,7 @@ static ssize_t ap_depth_show(struct device *dev, struct device_attribute *attr,
	return snprintf(buf, PAGE_SIZE, "%d\n", ac->queue_depth);
}

static DEVICE_ATTR(depth, 0444, ap_depth_show, NULL);
static DEVICE_ATTR_RO(depth);

static ssize_t ap_functions_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
@@ -58,7 +58,7 @@ static ssize_t ap_functions_show(struct device *dev,

static DEVICE_ATTR_RO(ap_functions);

static ssize_t ap_req_count_show(struct device *dev,
static ssize_t request_count_show(struct device *dev,
				  struct device_attribute *attr,
				  char *buf)
{
@@ -72,7 +72,7 @@ static ssize_t ap_req_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
}

static ssize_t ap_req_count_store(struct device *dev,
static ssize_t request_count_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{
@@ -88,9 +88,9 @@ static ssize_t ap_req_count_store(struct device *dev,
	return count;
}

static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store);
static DEVICE_ATTR_RW(request_count);

static ssize_t ap_requestq_count_show(struct device *dev,
static ssize_t requestq_count_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct ap_card *ac = to_ap_card(dev);
@@ -105,9 +105,9 @@ static ssize_t ap_requestq_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
}

static DEVICE_ATTR(requestq_count, 0444, ap_requestq_count_show, NULL);
static DEVICE_ATTR_RO(requestq_count);

static ssize_t ap_pendingq_count_show(struct device *dev,
static ssize_t pendingq_count_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct ap_card *ac = to_ap_card(dev);
@@ -122,15 +122,15 @@ static ssize_t ap_pendingq_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
}

static DEVICE_ATTR(pendingq_count, 0444, ap_pendingq_count_show, NULL);
static DEVICE_ATTR_RO(pendingq_count);

static ssize_t ap_modalias_show(struct device *dev,
static ssize_t modalias_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
	return sprintf(buf, "ap:t%02X\n", to_ap_dev(dev)->device_type);
}

static DEVICE_ATTR(modalias, 0444, ap_modalias_show, NULL);
static DEVICE_ATTR_RO(modalias);

static struct attribute *ap_card_dev_attrs[] = {
	&dev_attr_hwtype.attr,
+19 −19
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ EXPORT_SYMBOL(ap_queue_resume);
/*
 * AP queue related attributes.
 */
static ssize_t ap_req_count_show(struct device *dev,
static ssize_t request_count_show(struct device *dev,
				  struct device_attribute *attr,
				  char *buf)
{
@@ -475,7 +475,7 @@ static ssize_t ap_req_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
}

static ssize_t ap_req_count_store(struct device *dev,
static ssize_t request_count_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{
@@ -488,9 +488,9 @@ static ssize_t ap_req_count_store(struct device *dev,
	return count;
}

static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store);
static DEVICE_ATTR_RW(request_count);

static ssize_t ap_requestq_count_show(struct device *dev,
static ssize_t requestq_count_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct ap_queue *aq = to_ap_queue(dev);
@@ -502,9 +502,9 @@ static ssize_t ap_requestq_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
}

static DEVICE_ATTR(requestq_count, 0444, ap_requestq_count_show, NULL);
static DEVICE_ATTR_RO(requestq_count);

static ssize_t ap_pendingq_count_show(struct device *dev,
static ssize_t pendingq_count_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct ap_queue *aq = to_ap_queue(dev);
@@ -516,9 +516,9 @@ static ssize_t ap_pendingq_count_show(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
}

static DEVICE_ATTR(pendingq_count, 0444, ap_pendingq_count_show, NULL);
static DEVICE_ATTR_RO(pendingq_count);

static ssize_t ap_reset_show(struct device *dev,
static ssize_t reset_show(struct device *dev,
			  struct device_attribute *attr, char *buf)
{
	struct ap_queue *aq = to_ap_queue(dev);
@@ -541,9 +541,9 @@ static ssize_t ap_reset_show(struct device *dev,
	return rc;
}

static DEVICE_ATTR(reset, 0444, ap_reset_show, NULL);
static DEVICE_ATTR_RO(reset);

static ssize_t ap_interrupt_show(struct device *dev,
static ssize_t interrupt_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{
	struct ap_queue *aq = to_ap_queue(dev);
@@ -560,7 +560,7 @@ static ssize_t ap_interrupt_show(struct device *dev,
	return rc;
}

static DEVICE_ATTR(interrupt, 0444, ap_interrupt_show, NULL);
static DEVICE_ATTR_RO(interrupt);

static struct attribute *ap_queue_dev_attrs[] = {
	&dev_attr_request_count.attr,
Loading