Skip to contentSkip to conversation

drivers: habanalabs: Remove unnecessary (void*) conversions

PATCH Applied Li zeming 2 participants 2 messages Sep 19, 2022 Char and misc drivers

lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 drivers: habanalabs: Remove unnecessary (void*) conversions

The void pointer object can be directly assigned to different structure objects, it does not need to be cast.

---
 drivers/misc/habanalabs/gaudi2/gaudi2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/habanalabs/gaudi2/gaudi2.c +5 -5
index 98336a1a84b0..264376617310 100644
@@ -6149,7 +6149,7 @@ static int gaudi2_non_hard_reset_late_init(struct hl_device *hdev)
 static void gaudi2_is_tpc_engine_idle(struct hl_device *hdev, int dcore, int inst, u32 offset,
 					void *data)
 {
-	struct gaudi2_tpc_idle_data *idle_data = (struct gaudi2_tpc_idle_data *)data;
+	struct gaudi2_tpc_idle_data *idle_data = data;
 	u32 tpc_cfg_sts, qm_glbl_sts0, qm_glbl_sts1, qm_cgm_sts;
 	bool is_eng_idle;
 	int engine_idx;
@@ -6727,7 +6727,7 @@ static int gaudi2_mmu_shared_prepare(struct hl_device *hdev, u32 asid)
 static void gaudi2_tpc_mmu_prepare(struct hl_device *hdev, int dcore, int inst,	u32 offset,
 					void *data)
 {
-	struct gaudi2_tpc_mmu_data *mmu_data = (struct gaudi2_tpc_mmu_data *)data;
+	struct gaudi2_tpc_mmu_data *mmu_data = data;
 
 	WREG32(mmDCORE0_TPC0_CFG_AXUSER_HB_MMU_BP + offset, 0);
 	WREG32(mmDCORE0_TPC0_CFG_AXUSER_HB_ASID + offset, mmu_data->rw_asid);
@@ -9336,7 +9336,7 @@ static u32 gaudi2_get_queue_id_for_cq(struct hl_device *hdev, u32 cq_idx)
 
 static u32 gaudi2_gen_signal_cb(struct hl_device *hdev, void *data, u16 sob_id, u32 size, bool eb)
 {
-	struct hl_cb *cb = (struct hl_cb *) data;
+	struct hl_cb *cb = data;
 	struct packet_msg_short *pkt;
 	u32 value, ctl, pkt_size = sizeof(*pkt);
 
@@ -9429,7 +9429,7 @@ static u32 gaudi2_add_fence_pkt(struct packet_fence *pkt)
 
 static u32 gaudi2_gen_wait_cb(struct hl_device *hdev, struct hl_gen_wait_properties *prop)
 {
-	struct hl_cb *cb = (struct hl_cb *) prop->data;
+	struct hl_cb *cb = prop->data;
 	void *buf = (void *) (uintptr_t) (cb->kernel_address);
 
 	u64 monitor_base, fence_addr = 0;
@@ -9481,7 +9481,7 @@ static u32 gaudi2_gen_wait_cb(struct hl_device *hdev, struct hl_gen_wait_propert
 
 static void gaudi2_reset_sob(struct hl_device *hdev, void *data)
 {
-	struct hl_hw_sob *hw_sob = (struct hl_hw_sob *) data;
+	struct hl_hw_sob *hw_sob = data;
 
 	dev_dbg(hdev->dev, "reset SOB, q_idx: %d, sob_id: %d\n", hw_sob->q_idx, hw_sob->sob_id);
 
Signature · 1 line
2.18.2
Reviewed-by on v1 1/1 Applied
#1 lore raw
Quoted 59 lines · Li zeming

The void pointer object can be directly assigned to different structure objects, it does not need to be cast.

---
 drivers/misc/habanalabs/gaudi2/gaudi2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/habanalabs/gaudi2/gaudi2.c +5 -6
index 98336a1a84b0..264376617310 100644
@@ -6149,7 +6149,7 @@ static int gaudi2_non_hard_reset_late_init(struct hl_device *hdev)
 static void gaudi2_is_tpc_engine_idle(struct hl_device *hdev, int dcore, int inst, u32 offset,
                                        void *data)
 {
-       struct gaudi2_tpc_idle_data *idle_data = (struct gaudi2_tpc_idle_data *)data;
+       struct gaudi2_tpc_idle_data *idle_data = data;
        u32 tpc_cfg_sts, qm_glbl_sts0, qm_glbl_sts1, qm_cgm_sts;
        bool is_eng_idle;
        int engine_idx;
@@ -6727,7 +6727,7 @@ static int gaudi2_mmu_shared_prepare(struct hl_device *hdev, u32 asid)
 static void gaudi2_tpc_mmu_prepare(struct hl_device *hdev, int dcore, int inst,        u32 offset,
                                        void *data)
 {
-       struct gaudi2_tpc_mmu_data *mmu_data = (struct gaudi2_tpc_mmu_data *)data;
+       struct gaudi2_tpc_mmu_data *mmu_data = data;
 
        WREG32(mmDCORE0_TPC0_CFG_AXUSER_HB_MMU_BP + offset, 0);
        WREG32(mmDCORE0_TPC0_CFG_AXUSER_HB_ASID + offset, mmu_data->rw_asid);
@@ -9336,7 +9336,7 @@ static u32 gaudi2_get_queue_id_for_cq(struct hl_device *hdev, u32 cq_idx)
 
 static u32 gaudi2_gen_signal_cb(struct hl_device *hdev, void *data, u16 sob_id, u32 size, bool eb)
 {
-       struct hl_cb *cb = (struct hl_cb *) data;
+       struct hl_cb *cb = data;
        struct packet_msg_short *pkt;
        u32 value, ctl, pkt_size = sizeof(*pkt);
 
@@ -9429,7 +9429,7 @@ static u32 gaudi2_add_fence_pkt(struct packet_fence *pkt)
 
 static u32 gaudi2_gen_wait_cb(struct hl_device *hdev, struct hl_gen_wait_properties *prop)
 {
-       struct hl_cb *cb = (struct hl_cb *) prop->data;
+       struct hl_cb *cb = prop->data;
        void *buf = (void *) (uintptr_t) (cb->kernel_address);
 
        u64 monitor_base, fence_addr = 0;
@@ -9481,7 +9481,7 @@ static u32 gaudi2_gen_wait_cb(struct hl_device *hdev, struct hl_gen_wait_propert
 
 static void gaudi2_reset_sob(struct hl_device *hdev, void *data)
 {
-       struct hl_hw_sob *hw_sob = (struct hl_hw_sob *) data;
+       struct hl_hw_sob *hw_sob = data;
 
        dev_dbg(hdev->dev, "reset SOB, q_idx: %d, sob_id: %d\n", hw_sob->q_idx, hw_sob->sob_id);
 
--
Quoted 2 lines

2.18.2

This patch is:

Applied to -next.
Thanks,
Oded