Commit 2c2b94f9 authored by Dean Nelson's avatar Dean Nelson Committed by Tony Luck

[IA64] run drivers/misc/sgi-xp through scripts/checkpatch.pl

Addressed issues raised by scripts/checkpatch.pl. Removed unnecessary curly
braces. Eliminated uses of volatiles and use of kernel_thread() and daemonize().
Signed-off-by: default avatarDean Nelson <dcn@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 35190506
......@@ -79,9 +79,9 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
ret = bte_copy(src, pdst, len, mode, notification);
if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
if (!in_interrupt()) {
if (!in_interrupt())
cond_resched();
}
ret = bte_copy(src, pdst, len, mode, notification);
}
......@@ -255,7 +255,7 @@ enum xpc_retval {
/* 115: BTE end */
xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
xpcUnknownReason /* 116: unknown reason -- must be last in list */
xpcUnknownReason /* 116: unknown reason - must be last in enum */
};
/*
......
......@@ -23,15 +23,21 @@
#include "xp.h"
/*
* Target of nofault PIO read.
* The export of xp_nofault_PIOR needs to happen here since it is defined
* in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is
* defined here.
*/
EXPORT_SYMBOL_GPL(xp_nofault_PIOR);
u64 xp_nofault_PIOR_target;
EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target);
/*
* xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
* users of XPC.
*/
struct xpc_registration xpc_registrations[XPC_NCHANNELS];
EXPORT_SYMBOL_GPL(xpc_registrations);
/*
* Initialize the XPC interface to indicate that XPC isn't loaded.
......@@ -52,6 +58,7 @@ struct xpc_interface xpc_interface = {
(void (*)(partid_t, int, void *))xpc_notloaded,
(enum xpc_retval(*)(partid_t, void *))xpc_notloaded
};
EXPORT_SYMBOL_GPL(xpc_interface);
/*
* XPC calls this when it (the XPC module) has been loaded.
......@@ -74,6 +81,7 @@ xpc_set_interface(void (*connect) (int),
xpc_interface.received = received;
xpc_interface.partid_to_nasids = partid_to_nasids;
}
EXPORT_SYMBOL_GPL(xpc_set_interface);
/*
* XPC calls this when it (the XPC module) is being unloaded.
......@@ -95,6 +103,7 @@ xpc_clear_interface(void)
xpc_interface.partid_to_nasids = (enum xpc_retval(*)(partid_t, void *))
xpc_notloaded;
}
EXPORT_SYMBOL_GPL(xpc_clear_interface);
/*
* Register for automatic establishment of a channel connection whenever
......@@ -133,9 +142,8 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
registration = &xpc_registrations[ch_number];
if (mutex_lock_interruptible(&registration->mutex) != 0) {
if (mutex_lock_interruptible(&registration->mutex) != 0)
return xpcInterrupted;
}
/* if XPC_CHANNEL_REGISTERED(ch_number) */
if (registration->func != NULL) {
......@@ -157,6 +165,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
return xpcSuccess;
}
EXPORT_SYMBOL_GPL(xpc_connect);
/*
* Remove the registration for automatic connection of the specified channel
......@@ -207,6 +216,7 @@ xpc_disconnect(int ch_number)
return;
}
EXPORT_SYMBOL_GPL(xpc_disconnect);
int __init
xp_init(void)
......@@ -215,9 +225,8 @@ xp_init(void)
u64 func_addr = *(u64 *)xp_nofault_PIOR;
u64 err_func_addr = *(u64 *)xp_error_PIOR;
if (!ia64_platform_is("sn2")) {
if (!ia64_platform_is("sn2"))
return -ENODEV;
}
/*
* Register a nofault code region which performs a cross-partition
......@@ -228,8 +237,9 @@ xp_init(void)
* least some CPUs on Shubs <= v1.2, which unfortunately we have to
* work around).
*/
if ((ret = sn_register_nofault_code(func_addr, err_func_addr,
err_func_addr, 1, 1)) != 0) {
ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
1, 1);
if (ret != 0) {
printk(KERN_ERR "XP: can't register nofault code, error=%d\n",
ret);
}
......@@ -237,16 +247,14 @@ xp_init(void)
* Setup the nofault PIO read target. (There is no special reason why
* SH_IPI_ACCESS was selected.)
*/
if (is_shub2()) {
if (is_shub2())
xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
} else {
else
xp_nofault_PIOR_target = SH1_IPI_ACCESS;
}
/* initialize the connection registration mutex */
for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++) {
for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++)
mutex_init(&xpc_registrations[ch_number].mutex);
}
return 0;
}
......@@ -269,12 +277,3 @@ module_exit(xp_exit);
MODULE_AUTHOR("Silicon Graphics, Inc.");
MODULE_DESCRIPTION("Cross Partition (XP) base");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(xp_nofault_PIOR);
EXPORT_SYMBOL(xp_nofault_PIOR_target);
EXPORT_SYMBOL(xpc_registrations);
EXPORT_SYMBOL(xpc_interface);
EXPORT_SYMBOL(xpc_clear_interface);
EXPORT_SYMBOL(xpc_set_interface);
EXPORT_SYMBOL(xpc_connect);
EXPORT_SYMBOL(xpc_disconnect);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -75,19 +75,19 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
{
/* see if kmalloc will give us cachline aligned memory by default */
*base = kmalloc(size, flags);
if (*base == NULL) {
if (*base == NULL)
return NULL;
}
if ((u64)*base == L1_CACHE_ALIGN((u64)*base)) {
if ((u64)*base == L1_CACHE_ALIGN((u64)*base))
return *base;
}
kfree(*base);
/* nope, we'll have to do it ourselves */
*base = kmalloc(size + L1_CACHE_BYTES, flags);
if (*base == NULL) {
if (*base == NULL)
return NULL;
}
return (void *)L1_CACHE_ALIGN((u64)*base);
}
......@@ -116,9 +116,8 @@ xpc_get_rsvd_page_pa(int nasid)
"0x%016lx, address=0x%016lx, len=0x%016lx\n",
status, cookie, rp_pa, len);
if (status != SALRET_MORE_PASSES) {
if (status != SALRET_MORE_PASSES)
break;
}
if (L1_CACHE_ALIGN(len) > buf_len) {
kfree(buf_base);
......@@ -145,9 +144,9 @@ xpc_get_rsvd_page_pa(int nasid)
kfree(buf_base);
if (status != SALRET_OK) {
if (status != SALRET_OK)
rp_pa = 0;
}
dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa);
return rp_pa;
}
......@@ -210,7 +209,8 @@ xpc_rsvd_page_init(void)
* on subsequent loads of XPC. This AMO page is never freed, and its
* memory protections are never restricted.
*/
if ((amos_page = xpc_vars->amos_page) == NULL) {
amos_page = xpc_vars->amos_page;
if (amos_page == NULL) {
amos_page = (AMO_t *)TO_AMO(uncached_alloc_page(0));
if (amos_page == NULL) {
dev_err(xpc_part, "can't allocate page of AMOs\n");
......@@ -264,9 +264,8 @@ xpc_rsvd_page_init(void)
XP_MAX_PARTITIONS);
/* initialize the activate IRQ related AMO variables */
for (i = 0; i < xp_nasid_mask_words; i++) {
for (i = 0; i < xp_nasid_mask_words; i++)
(void)xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
}
/* initialize the engaged remote partitions related AMO variables */
(void)xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
......@@ -294,7 +293,7 @@ xpc_allow_IPI_ops(void)
int node;
int nasid;
// >>> Change SH_IPI_ACCESS code to use SAL call once it is available.
/* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
if (is_shub2()) {
xpc_sh2_IPI_access0 =
......@@ -336,14 +335,14 @@ xpc_allow_IPI_ops(void)
xpc_prot_vec[node] = (u64)HUB_L((u64 *)
GLOBAL_MMR_ADDR
(nasid,
SH1_MD_DQLP_MMR_DIR_PRIVEC0));
SH1_MD_DQLP_MMR_DIR_PRIVEC0));
HUB_S((u64 *)
GLOBAL_MMR_ADDR(nasid,
SH1_MD_DQLP_MMR_DIR_PRIVEC0),
SH1_MD_DQLP_MMR_DIR_PRIVEC0),
-1UL);
HUB_S((u64 *)
GLOBAL_MMR_ADDR(nasid,
SH1_MD_DQRP_MMR_DIR_PRIVEC0),
SH1_MD_DQRP_MMR_DIR_PRIVEC0),
-1UL);
}
}
......@@ -360,7 +359,7 @@ xpc_restrict_IPI_ops(void)
int node;
int nasid;
// >>> Change SH_IPI_ACCESS code to use SAL call once it is available.
/* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
if (is_shub2()) {
......@@ -385,10 +384,10 @@ xpc_restrict_IPI_ops(void)
if (enable_shub_wars_1_1()) {
HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
SH1_MD_DQLP_MMR_DIR_PRIVEC0),
SH1_MD_DQLP_MMR_DIR_PRIVEC0),
xpc_prot_vec[node]);
HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
SH1_MD_DQRP_MMR_DIR_PRIVEC0),
SH1_MD_DQRP_MMR_DIR_PRIVEC0),
xpc_prot_vec[node]);
}
}
......@@ -411,13 +410,11 @@ xpc_check_remote_hb(void)
for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
if (xpc_exiting) {
if (xpc_exiting)
break;
}
if (partid == sn_partition_id) {
if (partid == sn_partition_id)
continue;
}
part = &xpc_partitions[partid];
......@@ -471,24 +468,21 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
/* get the reserved page's physical address */
*remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
if (*remote_rp_pa == 0) {
if (*remote_rp_pa == 0)
return xpcNoRsvdPageAddr;
}
/* pull over the reserved page header and part_nasids mask */
bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp,
XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes,
(BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bres != BTE_SUCCESS) {
if (bres != BTE_SUCCESS)
return xpc_map_bte_errors(bres);
}
if (discovered_nasids != NULL) {
u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp);
for (i = 0; i < xp_nasid_mask_words; i++) {
for (i = 0; i < xp_nasid_mask_words; i++)
discovered_nasids[i] |= remote_part_nasids[i];
}
}
/* check that the partid is for another partition */
......@@ -498,9 +492,8 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
return xpcInvalidPartid;
}
if (remote_rp->partid == sn_partition_id) {
if (remote_rp->partid == sn_partition_id)
return xpcLocalPartid;
}
if (XPC_VERSION_MAJOR(remote_rp->version) !=
XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
......@@ -521,16 +514,14 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
{
int bres;
if (remote_vars_pa == 0) {
if (remote_vars_pa == 0)
return xpcVarsNotSet;
}
/* pull over the cross partition variables */
bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
(BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bres != BTE_SUCCESS) {
if (bres != BTE_SUCCESS)
return xpc_map_bte_errors(bres);
}
if (XPC_VERSION_MAJOR(remote_vars->version) !=
XPC_VERSION_MAJOR(XPC_V_VERSION)) {
......@@ -630,9 +621,9 @@ xpc_identify_act_IRQ_req(int nasid)
remote_vars_pa = remote_rp->vars_pa;
remote_rp_version = remote_rp->version;
if (XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
if (XPC_SUPPORTS_RP_STAMP(remote_rp_version))
remote_rp_stamp = remote_rp->stamp;
}
partid = remote_rp->partid;
part = &xpc_partitions[partid];
......@@ -656,7 +647,8 @@ xpc_identify_act_IRQ_req(int nasid)
"%ld:0x%lx\n", (int)nasid, (int)partid, part->act_IRQ_rcvd,
remote_vars->heartbeat, remote_vars->heartbeating_to_mask);
if (xpc_partition_disengaged(part) && part->act_state == XPC_P_INACTIVE) {
if (xpc_partition_disengaged(part) &&
part->act_state == XPC_P_INACTIVE) {
xpc_update_partition_info(part, remote_rp_version,
&remote_rp_stamp, remote_rp_pa,
......@@ -791,9 +783,8 @@ xpc_identify_act_IRQ_sender(void)
/* scan through act AMO variable looking for non-zero entries */
for (word = 0; word < xp_nasid_mask_words; word++) {
if (xpc_exiting) {
if (xpc_exiting)
break;
}
nasid_mask = xpc_IPI_receive(&act_amos[word]);
if (nasid_mask == 0) {
......@@ -840,7 +831,8 @@ xpc_partition_disengaged(struct xpc_partition *part)
disengaged = (xpc_partition_engaged(1UL << partid) == 0);
if (part->disengage_request_timeout) {
if (!disengaged) {
if (time_before(jiffies, part->disengage_request_timeout)) {
if (time_before(jiffies,
part->disengage_request_timeout)) {
/* timelimit hasn't been reached yet */
return 0;
}
......@@ -866,13 +858,11 @@ xpc_partition_disengaged(struct xpc_partition *part)
DBUG_ON(part->act_state != XPC_P_DEACTIVATING &&
part->act_state != XPC_P_INACTIVE);
if (part->act_state != XPC_P_INACTIVE) {
if (part->act_state != XPC_P_INACTIVE)
xpc_wakeup_channel_mgr(part);
}
if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version))
xpc_cancel_partition_disengage_request(part);
}
}
return disengaged;
}
......@@ -1000,9 +990,9 @@ xpc_discovery(void)
remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
xp_nasid_mask_bytes,
GFP_KERNEL, &remote_rp_base);
if (remote_rp == NULL) {
if (remote_rp == NULL)
return;
}
remote_vars = (struct xpc_vars *)remote_rp;
discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words,
......@@ -1035,18 +1025,16 @@ xpc_discovery(void)
for (region = 0; region < max_regions; region++) {
if ((volatile int)xpc_exiting) {
if (xpc_exiting)
break;
}
dev_dbg(xpc_part, "searching region %d\n", region);
for (nasid = (region * region_size * 2);
nasid < ((region + 1) * region_size * 2); nasid += 2) {
if ((volatile int)xpc_exiting) {
if (xpc_exiting)
break;
}
dev_dbg(xpc_part, "checking nasid %d\n", nasid);
......@@ -1080,9 +1068,9 @@ xpc_discovery(void)
"from nasid %d, reason=%d\n", nasid,
ret);
if (ret == xpcLocalPartid) {
if (ret == xpcLocalPartid)
break;
}
continue;
}
......@@ -1171,9 +1159,8 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
int bte_res;
part = &xpc_partitions[partid];
if (part->remote_rp_pa == 0) {
if (part->remote_rp_pa == 0)
return xpcPartitionDown;
}
memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
......
......@@ -21,6 +21,7 @@
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ioport.h>
......@@ -34,7 +35,6 @@
#include <asm/sn/bte.h>
#include <asm/sn/io.h>
#include <asm/sn/sn_sal.h>
#include <asm/types.h>
#include <asm/atomic.h>
#include "xp.h"
......@@ -87,8 +87,8 @@ struct xpnet_message {
#define XPNET_VERSION_MAJOR(_v) ((_v) >> 4)
#define XPNET_VERSION_MINOR(_v) ((_v) & 0xf)
#define XPNET_VERSION _XPNET_VERSION(1,0) /* version 1.0 */
#define XPNET_VERSION_EMBED _XPNET_VERSION(1,1) /* version 1.1 */
#define XPNET_VERSION _XPNET_VERSION(1, 0) /* version 1.0 */
#define XPNET_VERSION_EMBED _XPNET_VERSION(1, 1) /* version 1.1 */
#define XPNET_MAGIC 0x88786984 /* "XNET" */
#define XPNET_VALID_MSG(_m) \
......@@ -236,9 +236,11 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg)
msg->size, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bret != BTE_SUCCESS) {
// >>> Need better way of cleaning skb. Currently skb
// >>> appears in_use and we can't just call
// >>> dev_kfree_skb.
/*
* >>> Need better way of cleaning skb. Currently skb
* >>> appears in_use and we can't just call
* >>> dev_kfree_skb.
*/
dev_err(xpnet, "bte_copy(0x%p, 0x%p, 0x%hx) returned "
"error=0x%x\n", (void *)msg->buf_pa,
(void *)__pa((u64)skb->data &
......@@ -314,9 +316,8 @@ xpnet_connection_activity(enum xpc_retval reason, partid_t partid, int channel,
bp = xpnet_broadcast_partitions;
spin_unlock_bh(&xpnet_broadcast_lock);
if (bp == 0) {
if (bp == 0)
netif_carrier_off(xpnet_device);
}
dev_dbg(xpnet, "%s disconnected from partition %d; "
"xpnet_broadcast_partitions=0x%lx\n",
......@@ -527,9 +528,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL,
XPC_NOWAIT, (void **)&msg);
if (unlikely(ret != xpcSuccess)) {
if (unlikely(ret != xpcSuccess))
continue;
}
msg->embedded_bytes = embedded_bytes;
if (unlikely(embedded_bytes != 0)) {
......@@ -561,7 +561,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
atomic_dec(&queued_msg->use_count);
continue;
}
}
if (atomic_dec_return(&queued_msg->use_count) == 0) {
......@@ -599,9 +598,8 @@ xpnet_init(void)
u32 license_num;
int result = -ENOMEM;
if (!ia64_platform_is("sn2")) {
if (!ia64_platform_is("sn2"))
return -ENODEV;
}
dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
......@@ -611,9 +609,8 @@ xpnet_init(void)
*/
xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private),
XPNET_DEVICE_NAME, ether_setup);
if (xpnet_device == NULL) {
if (xpnet_device == NULL)
return -ENOMEM;
}
netif_carrier_off(xpnet_device);
......@@ -654,9 +651,8 @@ xpnet_init(void)
xpnet_device->features = NETIF_F_NO_CSUM;
result = register_netdev(xpnet_device);
if (result != 0) {
if (result != 0)
free_netdev(xpnet_device);
}
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment