Skip to contentSkip to conversation

drivers: Use bool function return values true/false not 1/0

PATCH Applied Joe Perches 6 participants 13 messages Mar 30, 2015 – Apr 7, 2015

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

cover drivers: Use bool function return values true/false not 1/0

Joe Perches (7):
drm: Use bool function return values of true/false not 1/0
dm_table: Use bool function return values of true/false not 1/0
genwqe: Use bool function return values of true/false not 1/0
wmi: Use bool function return values of true/false not 1/0
ssb: Use bool function return values of true/false not 1/0
thermal: Use bool function return values of true/false not 1/0
serial: kgdb_nmi: Use bool function return values of true/false not

    1/0
 drivers/gpu/drm/ast/ast_post.c        |  2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c |  2 +-
 drivers/md/dm-table.c                 | 20 ++++++++++----------
 drivers/misc/genwqe/card_base.h       |  2 +-
 drivers/platform/x86/wmi.c            |  4 ++--
 drivers/ssb/driver_gige.c             |  2 +-
 drivers/thermal/thermal_core.h        |  2 +-
 drivers/tty/serial/kgdb_nmi.c         |  6 +++---
 8 files changed, 20 insertions(+), 20 deletions(-)
Signature · 1 line
2.1.2
#2 lore raw

PATCH 2/7 dm_table: Use bool function return values of true/false not 1/0

Use the normal return values for bool functions

---
 drivers/md/dm-table.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/md/dm-table.c +10 -10
index e0f618b..d9b00b8 100644
@@ -1336,14 +1336,14 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
 			continue;
 
 		if (ti->flush_supported)
-			return 1;
+			return true;
 
 		if (ti->type->iterate_devices &&
 		    ti->type->iterate_devices(ti, device_flush_capable, &flush))
-			return 1;
+			return true;
 	}
 
-	return 0;
+	return false;
 }
 
 static bool dm_table_discard_zeroes_data(struct dm_table *t)
@@ -1356,10 +1356,10 @@ static bool dm_table_discard_zeroes_data(struct dm_table *t)
 		ti = dm_table_get_target(t, i++);
 
 		if (ti->discard_zeroes_data_unsupported)
-			return 0;
+			return false;
 	}
 
-	return 1;
+	return true;
 }
 
 static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
@@ -1405,10 +1405,10 @@ static bool dm_table_all_devices_attribute(struct dm_table *t,
 
 		if (!ti->type->iterate_devices ||
 		    !ti->type->iterate_devices(ti, func, NULL))
-			return 0;
+			return false;
 	}
 
-	return 1;
+	return true;
 }
 
 static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,
@@ -1465,14 +1465,14 @@ static bool dm_table_supports_discards(struct dm_table *t)
 			continue;
 
 		if (ti->discards_supported)
-			return 1;
+			return true;
 
 		if (ti->type->iterate_devices &&
 		    ti->type->iterate_devices(ti, device_discard_capable, NULL))
-			return 1;
+			return true;
 	}
 
-	return 0;
+	return false;
 }
 
 void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
Signature · 1 line
2.1.2
#5 lore raw

PATCH 4/7 wmi: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/platform/x86/wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/wmi.c +2 -2
index 26a0bd8..aac4757 100644
@@ -239,10 +239,10 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
 		if (memcmp(block->guid, guid_input, 16) == 0) {
 			if (out)
 				*out = wblock;
-			return 1;
+			return true;
 		}
 	}
-	return 0;
+	return false;
 }
 
 static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
Signature · 1 line
2.1.2
#10 lore raw

PATCH 6/7 thermal: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/thermal/thermal_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.h +1 -1
index 9e20e4d..749d41a 100644
@@ -115,7 +115,7 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
 static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,
 					    int trip)
 {
-	return 0;
+	return false;
 }
 static inline const struct thermal_trip *
 of_thermal_get_trip_points(struct thermal_zone_device *tz)
Signature · 1 line
2.1.2
#12 lore raw

PATCH 7/7 serial: kgdb_nmi: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/tty/serial/kgdb_nmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/serial/kgdb_nmi.c +3 -3
index 129dc5b..117df15 100644
@@ -173,18 +173,18 @@ static int kgdb_nmi_poll_one_knock(void)
 bool kgdb_nmi_poll_knock(void)
 {
 	if (kgdb_nmi_knock < 0)
-		return 1;
+		return true;
 
 	while (1) {
 		int ret;
 
 		ret = kgdb_nmi_poll_one_knock();
 		if (ret == NO_POLL_CHAR)
-			return 0;
+			return false;
 		else if (ret == 1)
 			break;
 	}
-	return 1;
+	return true;
 }
 
 /*
Signature · 1 line
2.1.2
#1 lore raw

PATCH 1/7 drm: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/gpu/drm/ast/ast_post.c        | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_post.c +1 -1
index 810c51d..6ce2a6f 100644
@@ -64,7 +64,7 @@ bool ast_is_vga_enabled(struct drm_device *dev)
 			return ch & 0x04;
 		}
 	}
-	return 0;
+	return false;
 }
 
 static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
index 945f1e0..704e231 100644
@@ -502,7 +502,7 @@ bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence)
 	struct vmw_fence_manager *fman = fman_from_fence(fence);
 
 	if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->base.flags))
-		return 1;
+		return true;
 
 	vmw_fences_update(fman);
 
Signature · 6 lines
2.1.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH 5/7 ssb: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/ssb/driver_gige.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ssb/driver_gige.c +1 -1
index e973405..ebee6b0 100644
@@ -242,7 +242,7 @@ static int ssb_gige_probe(struct ssb_device *sdev,
 bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
 {
 	if (!pdev->resource[0].name)
-		return 0;
+		return false;
 	return (strcmp(pdev->resource[0].name, SSB_GIGE_MEM_RES_NAME) == 0);
 }
 EXPORT_SYMBOL(pdev_is_ssb_gige_core);
Signature · 1 line
2.1.2
#4 lore raw

PATCH 3/7 genwqe: Use bool function return values of true/false not 1/0

In reply to Joe Perches

Use the normal return values for bool functions

---
 drivers/misc/genwqe/card_base.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/genwqe/card_base.h +1 -1
index e735344..2e57df1 100644
@@ -495,7 +495,7 @@ int  genwqe_user_vunmap(struct genwqe_dev *cd, struct dma_mapping *m,
 static inline bool dma_mapping_used(struct dma_mapping *m)
 {
 	if (!m)
-		return 0;
+		return false;
 	return m->size != 0;
 }
 
Signature · 1 line
2.1.2
maintainer
#8 lore raw

Re: [PATCH 5/7] ssb: Use bool function return values of true/false not 1/0

In reply to Joe Perches
Quoted 12 lines · On Mon, 30 Mar 2015 10:43:21 -0700 Joe Perches <[email protected]> wrote:

Use the normal return values for bool functions

---
 drivers/ssb/driver_gige.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ssb/driver_gige.c +0 -0
index e973405..ebee6b0 100644

drivers/ssb/driver_gige.c static int ssb_gige_probe(struct ssb_device *sdev, · line 248

Quoted 8 lines
drivers/ssb/driver_gige.c +1 -1
@@ -242,7 +242,7 @@ static int ssb_gige_probe(struct ssb_device *sdev,
 bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
 {
 	if (!pdev->resource[0].name)
-		return 0;
+		return false;
 	return (strcmp(pdev->resource[0].name, SSB_GIGE_MEM_RES_NAME) == 0);
 }
 EXPORT_SYMBOL(pdev_is_ssb_gige_core);

Looks good.

Kalle, can you take this one, please?

Signature · 1 line
Michael
#9 lore raw

Re: [PATCH 5/7] ssb: Use bool function return values of true/false not 1/0

In reply to Michael Büsch
Quoted 26 lines · Michael Büsch
Quoted 12 lines · On Mon, 30 Mar 2015 10:43:21 -0700 Joe Perches <[email protected]> wrote:

Use the normal return values for bool functions

---
 drivers/ssb/driver_gige.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ssb/driver_gige.c +0 -0
index e973405..ebee6b0 100644

drivers/ssb/driver_gige.c static int ssb_gige_probe(struct ssb_device *sdev, · line 248

Quoted 8 lines
drivers/ssb/driver_gige.c +1 -1
@@ -242,7 +242,7 @@ static int ssb_gige_probe(struct ssb_device *sdev,
 bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
 {
 	if (!pdev->resource[0].name)
-		return 0;
+		return false;
 	return (strcmp(pdev->resource[0].name, SSB_GIGE_MEM_RES_NAME) == 0);
 }
 EXPORT_SYMBOL(pdev_is_ssb_gige_core);

Looks good.

Quoted 3 lines

Kalle, can you take this one, please?

Sure, I'll apply it in the next few days.

Signature · 1 line
Kalle Valo
reviewer Applied
#11 lore raw

RE: [PATCH 6/7] thermal: Use bool function return values of true/false not 1/0

In reply to Joe Perches
Quoted 11 lines

-----Original Message-----
From: Joe Perches [mailto:[email protected]]
Sent: Tuesday, March 31, 2015 1:43 AM
To: [email protected]; Zhang, Rui; Eduardo Valentin
Cc: [email protected]
Subject: [PATCH 6/7] thermal: Use bool function return values of true/false not 1/0
Importance: High

Quoted 3 lines

Use the normal return values for bool functions

Applied.

Thanks,
rui

Quoted 20 lines
---
 drivers/thermal/thermal_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.h +0 -0
index 9e20e4d..749d41a 100644
@@ -115,7 +115,7 @@ static inline int of_thermal_get_ntrips(struct

thermal_zone_device *tz) static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,

drivers/thermal/thermal_core.h +1 -1
 					    int trip)
 {
-	return 0;
+	return false;
 }
 static inline const struct thermal_trip *  of_thermal_get_trip_points(struct

thermal_zone_device *tz)
--
2.1.2