Skip to content

Commit 9bce73a

Browse files
XenuIsWatchingkartben
authored andcommitted
drivers: i3c: cleanup const
There is const used in a few places and some hacks to get around that const. Just remove the const as well as remove the hacks. Signed-off-by: Ryan McClelland <[email protected]>
1 parent 79b526f commit 9bce73a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

drivers/i3c/i3c_common.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ int i3c_sec_get_basic_info(const struct device *dev, uint8_t dynamic_addr, uint8
399399
const struct i3c_driver_config *config = dev->config;
400400
int ret;
401401

402-
*(const struct device **)&temp_desc.bus = dev;
402+
temp_desc.bus = dev;
403403
temp_desc.dynamic_addr = dynamic_addr;
404404
temp_desc.bcr = bcr;
405405
temp_desc.dcr = dcr;
406-
/* attach it first with a temperary value so we can at least get the pid */
406+
/* attach it first with a temporary value so we can at least get the pid */
407407
ret = i3c_attach_i3c_device(&temp_desc);
408408
if (ret != 0) {
409409
return ret;
@@ -415,7 +415,7 @@ int i3c_sec_get_basic_info(const struct device *dev, uint8_t dynamic_addr, uint8
415415
return ret;
416416
}
417417

418-
*(uint64_t *)&id = sys_get_be48(getpid.pid);
418+
id.pid = sys_get_be48(getpid.pid);
419419

420420
/* try to see if we already have a device statically allocated */
421421
desc = i3c_dev_list_find(&config->dev_list, &id);
@@ -425,8 +425,8 @@ int i3c_sec_get_basic_info(const struct device *dev, uint8_t dynamic_addr, uint8
425425
if (!desc) {
426426
return -ENOMEM;
427427
}
428-
*(uint64_t *)&desc->pid = id.pid;
429-
*(uint16_t *)&temp_desc.static_addr = (uint16_t)static_addr;
428+
desc->pid = id.pid;
429+
temp_desc.static_addr = (uint16_t)static_addr;
430430
}
431431
desc->dynamic_addr = dynamic_addr;
432432
desc->bcr = bcr;
@@ -462,8 +462,8 @@ int i3c_sec_i2c_attach(const struct device *dev, uint8_t static_addr, uint8_t lv
462462
return -ENOMEM;
463463
}
464464
*(const struct device **)&i2c_desc->bus = dev;
465-
*(uint16_t *)&i2c_desc->addr = (uint16_t)static_addr;
466-
*(uint8_t *)&i2c_desc->lvr = lvr;
465+
i2c_desc->addr = (uint16_t)static_addr;
466+
i2c_desc->lvr = lvr;
467467
}
468468

469469
ret = i3c_attach_i2c_device(i2c_desc);

include/zephyr/drivers/i3c.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ __subsystem struct i3c_driver_api {
854854
*/
855855
struct i3c_device_id {
856856
/** Device Provisioned ID */
857-
const uint64_t pid:48;
857+
uint64_t pid:48;
858858
};
859859

860860
/**
@@ -890,13 +890,13 @@ struct i3c_device_desc {
890890
sys_snode_t node;
891891

892892
/** I3C bus to which this target device is attached */
893-
const struct device * const bus;
893+
const struct device *bus;
894894

895895
/** Device driver instance of the I3C device */
896-
const struct device * const dev;
896+
const struct device *dev;
897897

898898
/** Device Provisioned ID */
899-
const uint64_t pid;
899+
uint64_t pid;
900900

901901
/**
902902
* Static address for this target device.
@@ -910,7 +910,7 @@ struct i3c_device_desc {
910910
* device (as both are to tell target device to use static
911911
* address as dynamic address).
912912
*/
913-
const uint8_t static_addr;
913+
uint8_t static_addr;
914914

915915
/**
916916
* Initial dynamic address.
@@ -1107,13 +1107,13 @@ struct i3c_i2c_device_desc {
11071107
const struct device *bus;
11081108

11091109
/** Static address for this I2C device. */
1110-
const uint16_t addr;
1110+
uint16_t addr;
11111111

11121112
/**
11131113
* Legacy Virtual Register (LVR)
11141114
* @see @ref I3C_LVR
11151115
*/
1116-
const uint8_t lvr;
1116+
uint8_t lvr;
11171117

11181118
/** @cond INTERNAL_HIDDEN */
11191119
/**

0 commit comments

Comments
 (0)