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);
......@@ -110,16 +110,16 @@ struct xpc_rsvd_page {
u8 partid; /* SAL: partition ID */
u8 version;
u8 pad1[6]; /* align to next u64 in cacheline */
volatile u64 vars_pa;
u64 vars_pa; /* physical address of struct xpc_vars */
struct timespec stamp; /* time when reserved page was setup by XPC */
u64 pad2[9]; /* align to last u64 in cacheline */
u64 nasids_size; /* SAL: size of each nasid mask in bytes */
};
#define XPC_RP_VERSION _XPC_VERSION(1,1) /* version 1.1 of the reserved page */
#define XPC_RP_VERSION _XPC_VERSION(1, 1) /* version 1.1 of the reserved page */
#define XPC_SUPPORTS_RP_STAMP(_version) \
(_version >= _XPC_VERSION(1,1))
(_version >= _XPC_VERSION(1, 1))
/*
* compare stamps - the return value is:
......@@ -133,9 +133,10 @@ xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
{
int ret;
if ((ret = stamp1->tv_sec - stamp2->tv_sec) == 0) {
ret = stamp1->tv_sec - stamp2->tv_sec;
if (ret == 0)
ret = stamp1->tv_nsec - stamp2->tv_nsec;
}
return ret;
}
......@@ -165,10 +166,10 @@ struct xpc_vars {
AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
};
#define XPC_V_VERSION _XPC_VERSION(3,1) /* version 3.1 of the cross vars */
#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */
#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
(_version >= _XPC_VERSION(3,1))
(_version >= _XPC_VERSION(3, 1))
static inline int
xpc_hb_allowed(partid_t partid, struct xpc_vars *vars)
......@@ -224,7 +225,7 @@ xpc_disallow_hb(partid_t partid, struct xpc_vars *vars)
* occupies half a cacheline.
*/
struct xpc_vars_part {
volatile u64 magic;
u64 magic;
u64 openclose_args_pa; /* physical address of open and close args */
u64 GPs_pa; /* physical address of Get/Put values */
......@@ -255,10 +256,12 @@ struct xpc_vars_part {
#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars))
#define XPC_RP_PART_NASIDS(_rp) (u64 *) ((u8 *) _rp + XPC_RP_HEADER_SIZE)
#define XPC_RP_PART_NASIDS(_rp) ((u64 *)((u8 *)(_rp) + XPC_RP_HEADER_SIZE))
#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
#define XPC_RP_VARS(_rp) ((struct xpc_vars *) XPC_RP_MACH_NASIDS(_rp) + xp_nasid_mask_words)
#define XPC_RP_VARS_PART(_rp) (struct xpc_vars_part *) ((u8 *) XPC_RP_VARS(rp) + XPC_RP_VARS_SIZE)
#define XPC_RP_VARS(_rp) ((struct xpc_vars *)(XPC_RP_MACH_NASIDS(_rp) + \
xp_nasid_mask_words))
#define XPC_RP_VARS_PART(_rp) ((struct xpc_vars_part *) \
((u8 *)XPC_RP_VARS(_rp) + XPC_RP_VARS_SIZE))
/*
* Functions registered by add_timer() or called by kernel_thread() only
......@@ -277,8 +280,8 @@ struct xpc_vars_part {
* Define a Get/Put value pair (pointers) used with a message queue.
*/
struct xpc_gp {
volatile s64 get; /* Get value */
volatile s64 put; /* Put value */
s64 get; /* Get value */
s64 put; /* Put value */
};
#define XPC_GP_SIZE \
......@@ -315,7 +318,7 @@ struct xpc_openclose_args {
* and consumed by the intended recipient.
*/
struct xpc_notify {
volatile u8 type; /* type of notification */
u8 type; /* type of notification */
/* the following two fields are only used if type == XPC_N_CALL */
xpc_notify_func func; /* user's notify function */
......@@ -458,16 +461,11 @@ struct xpc_channel {
/* kthread management related fields */
// >>> rethink having kthreads_assigned_limit and kthreads_idle_limit; perhaps
// >>> allow the assigned limit be unbounded and let the idle limit be dynamic
// >>> dependent on activity over the last interval of time
atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
u32 kthreads_assigned_limit; /* limit on #of kthreads assigned */
atomic_t kthreads_idle; /* #of kthreads idle waiting for work */
u32 kthreads_idle_limit; /* limit on #of kthreads idle */
atomic_t kthreads_active; /* #of kthreads actively working */
// >>> following field is temporary
u32 kthreads_created; /* total #of kthreads created */
wait_queue_head_t idle_wq; /* idle kthread wait queue */
......@@ -533,7 +531,7 @@ struct xpc_partition {
/* XPC infrastructure referencing and teardown control */
volatile u8 setup_state; /* infrastructure setup state */
u8 setup_state; /* infrastructure setup state */
wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
atomic_t references; /* #of references to infrastructure */
......@@ -552,8 +550,8 @@ struct xpc_partition {
void *local_GPs_base; /* base address of kmalloc'd space */
struct xpc_gp *local_GPs; /* local Get/Put values */
void *remote_GPs_base; /* base address of kmalloc'd space */
struct xpc_gp *remote_GPs; /* copy of remote partition's local Get/Put */
/* values */
struct xpc_gp *remote_GPs; /* copy of remote partition's local */
/* Get/Put values */
u64 remote_GPs_pa; /* phys address of remote partition's local */
/* Get/Put values */
......@@ -678,9 +676,8 @@ extern void xpc_teardown_infrastructure(struct xpc_partition *);
static inline void
xpc_wakeup_channel_mgr(struct xpc_partition *part)
{
if (atomic_inc_return(&part->channel_mgr_requests) == 1) {
if (atomic_inc_return(&part->channel_mgr_requests) == 1)
wake_up(&part->channel_mgr_wq);
}
}
/*
......@@ -699,9 +696,8 @@ xpc_msgqueue_deref(struct xpc_channel *ch)
s32 refs = atomic_dec_return(&ch->references);
DBUG_ON(refs < 0);
if (refs == 0) {
if (refs == 0)
xpc_wakeup_channel_mgr(&xpc_partitions[ch->partid]);
}
}
#define XPC_DISCONNECT_CHANNEL(_ch, _reason, _irqflgs) \
......@@ -717,9 +713,8 @@ xpc_part_deref(struct xpc_partition *part)
s32 refs = atomic_dec_return(&part->references);
DBUG_ON(refs < 0);
if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN) {
if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN)
wake_up(&part->teardown_wq);
}
}
static inline int
......@@ -729,9 +724,9 @@ xpc_part_ref(struct xpc_partition *part)
atomic_inc(&part->references);
setup = (part->setup_state == XPC_P_SETUP);
if (!setup) {
if (!setup)
xpc_part_deref(part);
}
return setup;
}
......@@ -1007,15 +1002,13 @@ xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
ipi_flag_string, ch->partid, ch->number, ret);
if (unlikely(ret != xpcSuccess)) {
if (irq_flags != NULL) {
if (irq_flags != NULL)
spin_unlock_irqrestore(&ch->lock, *irq_flags);
}
XPC_DEACTIVATE_PARTITION(part, ret);
if (irq_flags != NULL) {
if (irq_flags != NULL)
spin_lock_irqsave(&ch->lock, *irq_flags);
}
}
}
}
/*
......@@ -1056,8 +1049,8 @@ xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & __IA64_UL_CONST(0x0f0f0f0f0f0f0f0f))
#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & __IA64_UL_CONST(0x1010101010101010))
#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0fUL)
#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010UL)
static inline void
xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
......@@ -1178,9 +1171,8 @@ xpc_check_for_channel_activity(struct xpc_partition *part)
unsigned long irq_flags;
IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
if (IPI_amo == 0) {
if (IPI_amo == 0)
return;
}
spin_lock_irqsave(&part->IPI_lock, irq_flags);
part->local_IPI_amo |= IPI_amo;
......
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 =
......@@ -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()) {
......@@ -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,25 +468,22 @@ 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,14 +858,12 @@ 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