Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] bdaddr: Remove *_CP_SIZE defines
@ 2014-03-07 22:55 Petri Gynther
  2014-03-10 20:30 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Petri Gynther @ 2014-03-07 22:55 UTC (permalink / raw)
  To: linux-bluetooth

Remove *_CP_SIZE defines and use sizeof(cp) instead.
---
 tools/bdaddr.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/tools/bdaddr.c b/tools/bdaddr.c
index ee9c01c..8356a8d 100644
--- a/tools/bdaddr.c
+++ b/tools/bdaddr.c
@@ -57,7 +57,6 @@ static int generic_reset_device(int dd)
 typedef struct {
 	bdaddr_t	bdaddr;
 } __attribute__ ((packed)) ericsson_write_bd_addr_cp;
-#define ERICSSON_WRITE_BD_ADDR_CP_SIZE 6
 
 static int ericsson_write_bd_addr(int dd, bdaddr_t *bdaddr)
 {
@@ -71,7 +70,7 @@ static int ericsson_write_bd_addr(int dd, bdaddr_t *bdaddr)
 	rq.ogf    = OGF_VENDOR_CMD;
 	rq.ocf    = OCF_ERICSSON_WRITE_BD_ADDR;
 	rq.cparam = &cp;
-	rq.clen   = ERICSSON_WRITE_BD_ADDR_CP_SIZE;
+	rq.clen   = sizeof(cp);
 	rq.rparam = NULL;
 	rq.rlen   = 0;
 
@@ -87,7 +86,6 @@ typedef struct {
 	uint8_t		flash_length;
 	uint8_t		flash_data[253];
 } __attribute__ ((packed)) ericsson_store_in_flash_cp;
-#define ERICSSON_STORE_IN_FLASH_CP_SIZE 255
 
 static int ericsson_store_in_flash(int dd, uint8_t user_id, uint8_t flash_length, uint8_t *flash_data)
 {
@@ -104,7 +102,7 @@ static int ericsson_store_in_flash(int dd, uint8_t user_id, uint8_t flash_length
 	rq.ogf    = OGF_VENDOR_CMD;
 	rq.ocf    = OCF_ERICSSON_STORE_IN_FLASH;
 	rq.cparam = &cp;
-	rq.clen   = ERICSSON_STORE_IN_FLASH_CP_SIZE;
+	rq.clen   = sizeof(cp);
 	rq.rparam = NULL;
 	rq.rlen   = 0;
 
@@ -199,7 +197,6 @@ static int csr_reset_device(int dd)
 typedef struct {
 	bdaddr_t	bdaddr;
 } __attribute__ ((packed)) ti_write_bd_addr_cp;
-#define TI_WRITE_BD_ADDR_CP_SIZE 6
 
 static int ti_write_bd_addr(int dd, bdaddr_t *bdaddr)
 {
@@ -213,7 +210,7 @@ static int ti_write_bd_addr(int dd, bdaddr_t *bdaddr)
 	rq.ogf    = OGF_VENDOR_CMD;
 	rq.ocf    = OCF_TI_WRITE_BD_ADDR;
 	rq.cparam = &cp;
-	rq.clen   = TI_WRITE_BD_ADDR_CP_SIZE;
+	rq.clen   = sizeof(cp);
 	rq.rparam = NULL;
 	rq.rlen   = 0;
 
@@ -227,7 +224,6 @@ static int ti_write_bd_addr(int dd, bdaddr_t *bdaddr)
 typedef struct {
 	bdaddr_t	bdaddr;
 } __attribute__ ((packed)) bcm_write_bd_addr_cp;
-#define BCM_WRITE_BD_ADDR_CP_SIZE 6
 
 static int bcm_write_bd_addr(int dd, bdaddr_t *bdaddr)
 {
@@ -241,7 +237,7 @@ static int bcm_write_bd_addr(int dd, bdaddr_t *bdaddr)
 	rq.ogf    = OGF_VENDOR_CMD;
 	rq.ocf    = OCF_BCM_WRITE_BD_ADDR;
 	rq.cparam = &cp;
-	rq.clen   = BCM_WRITE_BD_ADDR_CP_SIZE;
+	rq.clen   = sizeof(cp);
 	rq.rparam = NULL;
 	rq.rlen   = 0;
 
@@ -255,7 +251,6 @@ static int bcm_write_bd_addr(int dd, bdaddr_t *bdaddr)
 typedef struct {
 	bdaddr_t	bdaddr;
 } __attribute__ ((packed)) zeevo_write_bd_addr_cp;
-#define ZEEVO_WRITE_BD_ADDR_CP_SIZE 6
 
 static int zeevo_write_bd_addr(int dd, bdaddr_t *bdaddr)
 {
@@ -269,7 +264,7 @@ static int zeevo_write_bd_addr(int dd, bdaddr_t *bdaddr)
 	rq.ogf    = OGF_VENDOR_CMD;
 	rq.ocf    = OCF_ZEEVO_WRITE_BD_ADDR;
 	rq.cparam = &cp;
-	rq.clen   = ZEEVO_WRITE_BD_ADDR_CP_SIZE;
+	rq.clen   = sizeof(cp);
 	rq.rparam = NULL;
 	rq.rlen   = 0;
 
-- 
1.9.0.279.gdc9e3eb


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-10 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 22:55 [PATCH] bdaddr: Remove *_CP_SIZE defines Petri Gynther
2014-03-10 20:30 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox