Skip to content

Commit 7aefac2

Browse files
cminyardtorvalds
authored andcommitted
ipmi: boolify some things
Convert some ints to bools. Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8998649 commit 7aefac2

3 files changed

Lines changed: 38 additions & 40 deletions

File tree

‎drivers/char/ipmi/ipmi_msghandler.c‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ static struct proc_dir_entry *proc_ipmi_root;
9494
struct ipmi_user {
9595
struct list_head link;
9696

97-
/* Set to "0" when the user is destroyed. */
98-
int valid;
97+
/* Set to false when the user is destroyed. */
98+
bool valid;
9999

100100
struct kref refcount;
101101

@@ -413,7 +413,7 @@ struct ipmi_smi {
413413

414414
/* For handling of maintenance mode. */
415415
int maintenance_mode;
416-
int maintenance_mode_enable;
416+
bool maintenance_mode_enable;
417417
int auto_maintenance_timeout;
418418
spinlock_t maintenance_mode_lock; /* Used in a timer... */
419419

@@ -980,7 +980,7 @@ int ipmi_create_user(unsigned int if_num,
980980
*/
981981
mutex_unlock(&ipmi_interfaces_mutex);
982982

983-
new_user->valid = 1;
983+
new_user->valid = true;
984984
spin_lock_irqsave(&intf->seq_lock, flags);
985985
list_add_rcu(&new_user->link, &intf->users);
986986
spin_unlock_irqrestore(&intf->seq_lock, flags);
@@ -1042,7 +1042,7 @@ int ipmi_destroy_user(ipmi_user_t user)
10421042
struct cmd_rcvr *rcvr;
10431043
struct cmd_rcvr *rcvrs = NULL;
10441044

1045-
user->valid = 0;
1045+
user->valid = false;
10461046

10471047
if (user->handler->ipmi_watchdog_pretimeout)
10481048
atomic_dec(&intf->event_waiters);
@@ -1184,25 +1184,23 @@ int ipmi_set_maintenance_mode(ipmi_user_t user, int mode)
11841184
if (intf->maintenance_mode != mode) {
11851185
switch (mode) {
11861186
case IPMI_MAINTENANCE_MODE_AUTO:
1187-
intf->maintenance_mode = mode;
11881187
intf->maintenance_mode_enable
11891188
= (intf->auto_maintenance_timeout > 0);
11901189
break;
11911190

11921191
case IPMI_MAINTENANCE_MODE_OFF:
1193-
intf->maintenance_mode = mode;
1194-
intf->maintenance_mode_enable = 0;
1192+
intf->maintenance_mode_enable = false;
11951193
break;
11961194

11971195
case IPMI_MAINTENANCE_MODE_ON:
1198-
intf->maintenance_mode = mode;
1199-
intf->maintenance_mode_enable = 1;
1196+
intf->maintenance_mode_enable = true;
12001197
break;
12011198

12021199
default:
12031200
rv = -EINVAL;
12041201
goto out_unlock;
12051202
}
1203+
intf->maintenance_mode = mode;
12061204

12071205
maintenance_mode_update(intf);
12081206
}
@@ -1578,7 +1576,7 @@ static int i_ipmi_request(ipmi_user_t user,
15781576
= IPMI_MAINTENANCE_MODE_TIMEOUT;
15791577
if (!intf->maintenance_mode
15801578
&& !intf->maintenance_mode_enable) {
1581-
intf->maintenance_mode_enable = 1;
1579+
intf->maintenance_mode_enable = true;
15821580
maintenance_mode_update(intf);
15831581
}
15841582
spin_unlock_irqrestore(&intf->maintenance_mode_lock,
@@ -4129,7 +4127,7 @@ static unsigned int ipmi_timeout_handler(ipmi_smi_t intf, long timeout_period)
41294127
-= timeout_period;
41304128
if (!intf->maintenance_mode
41314129
&& (intf->auto_maintenance_timeout <= 0)) {
4132-
intf->maintenance_mode_enable = 0;
4130+
intf->maintenance_mode_enable = false;
41334131
maintenance_mode_update(intf);
41344132
}
41354133
}

‎drivers/char/ipmi/ipmi_si_intf.c‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ struct smi_info {
217217
unsigned char msg_flags;
218218

219219
/* Does the BMC have an event buffer? */
220-
char has_event_buffer;
220+
bool has_event_buffer;
221221

222222
/*
223223
* If set to true, this will request events the next time the
@@ -230,7 +230,7 @@ struct smi_info {
230230
* call. Generally used after a panic to make sure stuff goes
231231
* out.
232232
*/
233-
int run_to_completion;
233+
bool run_to_completion;
234234

235235
/* The I/O port of an SI interface. */
236236
int port;
@@ -266,7 +266,7 @@ struct smi_info {
266266
* memory. Once that situation clears up, it will re-enable
267267
* interrupts.
268268
*/
269-
int interrupt_disabled;
269+
bool interrupt_disabled;
270270

271271
/* From the get device id response... */
272272
struct ipmi_device_id device_id;
@@ -279,7 +279,7 @@ struct smi_info {
279279
* True if we allocated the device, false if it came from
280280
* someplace else (like PCI).
281281
*/
282-
int dev_registered;
282+
bool dev_registered;
283283

284284
/* Slave address, could be reported from DMI. */
285285
unsigned char slave_addr;
@@ -303,19 +303,19 @@ struct smi_info {
303303
static int force_kipmid[SI_MAX_PARMS];
304304
static int num_force_kipmid;
305305
#ifdef CONFIG_PCI
306-
static int pci_registered;
306+
static bool pci_registered;
307307
#endif
308308
#ifdef CONFIG_ACPI
309-
static int pnp_registered;
309+
static bool pnp_registered;
310310
#endif
311311
#ifdef CONFIG_PARISC
312-
static int parisc_registered;
312+
static bool parisc_registered;
313313
#endif
314314

315315
static unsigned int kipmid_max_busy_us[SI_MAX_PARMS];
316316
static int num_max_busy_us;
317317

318-
static int unload_when_empty = 1;
318+
static bool unload_when_empty = true;
319319

320320
static int add_smi(struct smi_info *smi);
321321
static int try_smi_init(struct smi_info *smi);
@@ -457,7 +457,7 @@ static inline void disable_si_irq(struct smi_info *smi_info)
457457
{
458458
if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {
459459
start_disable_irq(smi_info);
460-
smi_info->interrupt_disabled = 1;
460+
smi_info->interrupt_disabled = true;
461461
if (!atomic_read(&smi_info->stop_operation))
462462
smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES);
463463
}
@@ -467,7 +467,7 @@ static inline void enable_si_irq(struct smi_info *smi_info)
467467
{
468468
if ((smi_info->irq) && (smi_info->interrupt_disabled)) {
469469
start_enable_irq(smi_info);
470-
smi_info->interrupt_disabled = 0;
470+
smi_info->interrupt_disabled = false;
471471
}
472472
}
473473

@@ -712,7 +712,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
712712
dev_warn(smi_info->dev,
713713
"Maybe ok, but ipmi might run very slowly.\n");
714714
} else
715-
smi_info->interrupt_disabled = 0;
715+
smi_info->interrupt_disabled = false;
716716
smi_info->si_state = SI_NORMAL;
717717
break;
718718
}
@@ -935,7 +935,7 @@ static void sender(void *send_info,
935935
spin_unlock_irqrestore(&smi_info->si_lock, flags);
936936
}
937937

938-
static void set_run_to_completion(void *send_info, int i_run_to_completion)
938+
static void set_run_to_completion(void *send_info, bool i_run_to_completion)
939939
{
940940
struct smi_info *smi_info = send_info;
941941
enum si_sm_result result;
@@ -1050,7 +1050,7 @@ static void poll(void *send_info)
10501050
{
10511051
struct smi_info *smi_info = send_info;
10521052
unsigned long flags = 0;
1053-
int run_to_completion = smi_info->run_to_completion;
1053+
bool run_to_completion = smi_info->run_to_completion;
10541054

10551055
/*
10561056
* Make sure there is some delay in the poll loop so we can
@@ -1075,7 +1075,7 @@ static void request_events(void *send_info)
10751075
atomic_set(&smi_info->req_events, 1);
10761076
}
10771077

1078-
static void set_need_watch(void *send_info, int enable)
1078+
static void set_need_watch(void *send_info, bool enable)
10791079
{
10801080
struct smi_info *smi_info = send_info;
10811081
unsigned long flags;
@@ -1223,7 +1223,7 @@ static int get_smi_info(void *send_info, struct ipmi_smi_info *data)
12231223
return 0;
12241224
}
12251225

1226-
static void set_maintenance_mode(void *send_info, int enable)
1226+
static void set_maintenance_mode(void *send_info, bool enable)
12271227
{
12281228
struct smi_info *smi_info = send_info;
12291229

@@ -1364,7 +1364,7 @@ module_param_array(force_kipmid, int, &num_force_kipmid, 0);
13641364
MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or"
13651365
" disabled(0). Normally the IPMI driver auto-detects"
13661366
" this, but the value may be overridden by this parm.");
1367-
module_param(unload_when_empty, int, 0);
1367+
module_param(unload_when_empty, bool, 0);
13681368
MODULE_PARM_DESC(unload_when_empty, "Unload the module if no interfaces are"
13691369
" specified or found, default is 1. Setting to 0"
13701370
" is useful for hot add of devices using hotmod.");
@@ -3372,19 +3372,19 @@ static int try_smi_init(struct smi_info *new_smi)
33723372
INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs));
33733373
new_smi->curr_msg = NULL;
33743374
atomic_set(&new_smi->req_events, 0);
3375-
new_smi->run_to_completion = 0;
3375+
new_smi->run_to_completion = false;
33763376
for (i = 0; i < SI_NUM_STATS; i++)
33773377
atomic_set(&new_smi->stats[i], 0);
33783378

3379-
new_smi->interrupt_disabled = 1;
3379+
new_smi->interrupt_disabled = true;
33803380
atomic_set(&new_smi->stop_operation, 0);
33813381
atomic_set(&new_smi->need_watch, 0);
33823382
new_smi->intf_num = smi_num;
33833383
smi_num++;
33843384

33853385
rv = try_enable_event_buffer(new_smi);
33863386
if (rv == 0)
3387-
new_smi->has_event_buffer = 1;
3387+
new_smi->has_event_buffer = true;
33883388

33893389
/*
33903390
* Start clearing the flags before we enable interrupts or the
@@ -3418,7 +3418,7 @@ static int try_smi_init(struct smi_info *new_smi)
34183418
rv);
34193419
goto out_err;
34203420
}
3421-
new_smi->dev_registered = 1;
3421+
new_smi->dev_registered = true;
34223422
}
34233423

34243424
rv = ipmi_register_smi(&handlers,
@@ -3467,7 +3467,7 @@ static int try_smi_init(struct smi_info *new_smi)
34673467
wait_for_timer_and_thread(new_smi);
34683468

34693469
out_err:
3470-
new_smi->interrupt_disabled = 1;
3470+
new_smi->interrupt_disabled = true;
34713471

34723472
if (new_smi->intf) {
34733473
ipmi_unregister_smi(new_smi->intf);
@@ -3503,7 +3503,7 @@ static int try_smi_init(struct smi_info *new_smi)
35033503

35043504
if (new_smi->dev_registered) {
35053505
platform_device_unregister(new_smi->pdev);
3506-
new_smi->dev_registered = 0;
3506+
new_smi->dev_registered = false;
35073507
}
35083508

35093509
return rv;
@@ -3558,14 +3558,14 @@ static int init_ipmi_si(void)
35583558
printk(KERN_ERR PFX "Unable to register "
35593559
"PCI driver: %d\n", rv);
35603560
else
3561-
pci_registered = 1;
3561+
pci_registered = true;
35623562
}
35633563
#endif
35643564

35653565
#ifdef CONFIG_ACPI
35663566
if (si_tryacpi) {
35673567
pnp_register_driver(&ipmi_pnp_driver);
3568-
pnp_registered = 1;
3568+
pnp_registered = true;
35693569
}
35703570
#endif
35713571

@@ -3581,7 +3581,7 @@ static int init_ipmi_si(void)
35813581

35823582
#ifdef CONFIG_PARISC
35833583
register_parisc_driver(&ipmi_parisc_driver);
3584-
parisc_registered = 1;
3584+
parisc_registered = true;
35853585
/* poking PC IO addresses will crash machine, don't do it */
35863586
si_trydefaults = 0;
35873587
#endif

‎include/linux/ipmi_smi.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ struct ipmi_smi_handlers {
114114
pretimeouts, or not. Used by the SMI to know if it should
115115
watch for these. This may be NULL if the SMI does not
116116
implement it. */
117-
void (*set_need_watch)(void *send_info, int enable);
117+
void (*set_need_watch)(void *send_info, bool enable);
118118

119119
/* Called when the interface should go into "run to
120120
completion" mode. If this call sets the value to true, the
121121
interface should make sure that all messages are flushed
122122
out and that none are pending, and any new requests are run
123123
to completion immediately. */
124-
void (*set_run_to_completion)(void *send_info, int run_to_completion);
124+
void (*set_run_to_completion)(void *send_info, bool run_to_completion);
125125

126126
/* Called to poll for work to do. This is so upper layers can
127127
poll for operations during things like crash dumps. */
@@ -132,7 +132,7 @@ struct ipmi_smi_handlers {
132132
setting. The message handler does the mode handling. Note
133133
that this is called from interrupt context, so it cannot
134134
block. */
135-
void (*set_maintenance_mode)(void *send_info, int enable);
135+
void (*set_maintenance_mode)(void *send_info, bool enable);
136136

137137
/* Tell the handler that we are using it/not using it. The
138138
message handler get the modules that this handler belongs

0 commit comments

Comments
 (0)