Skip to content

Commit 9024001

Browse files
committed
media: atomisp: do some cleanup at irq_local.h
- Get rid of typedefs; - Get rid of a duplicated enum type with different names for ISP2400 and ISP2401; - adjust indentation on the touched code. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f2fb029 commit 9024001

File tree

5 files changed

+30
-44
lines changed

5 files changed

+30
-44
lines changed

drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ static inline void irq_wait_for_write_complete(
2929
static inline bool any_irq_channel_enabled(
3030
const irq_ID_t ID);
3131

32-
static inline irq_ID_t virq_get_irq_id(
33-
const virq_id_t irq_ID,
34-
unsigned int *channel_ID);
32+
static inline irq_ID_t virq_get_irq_id(const enum virq_id irq_ID,
33+
unsigned int *channel_ID);
3534

3635
#ifndef __INLINE_IRQ__
3736
#include "irq_private.h"
@@ -52,7 +51,7 @@ static unsigned short IRQ_N_ID_OFFSET[N_IRQ_ID + 1] = {
5251
IRQ_END_OFFSET
5352
};
5453

55-
static virq_id_t IRQ_NESTING_ID[N_IRQ_ID] = {
54+
static enum virq_id IRQ_NESTING_ID[N_IRQ_ID] = {
5655
N_virq_id,
5756
virq_ifmt,
5857
virq_isys,
@@ -228,9 +227,8 @@ void irq_raise(
228227
return;
229228
}
230229

231-
void irq_controller_get_state(
232-
const irq_ID_t ID,
233-
irq_controller_state_t *state)
230+
void irq_controller_get_state(const irq_ID_t ID,
231+
struct irq_controller_state *state)
234232
{
235233
assert(ID < N_IRQ_ID);
236234
assert(state);
@@ -257,7 +255,7 @@ bool any_virq_signal(void)
257255
}
258256

259257
void cnd_virq_enable_channel(
260-
const virq_id_t irq_ID,
258+
const enum virq_id irq_ID,
261259
const bool en)
262260
{
263261
irq_ID_t i;
@@ -297,8 +295,8 @@ void virq_clear_all(void)
297295
return;
298296
}
299297

300-
enum hrt_isp_css_irq_status virq_get_channel_signals(
301-
virq_info_t *irq_info)
298+
enum hrt_isp_css_irq_status
299+
virq_get_channel_signals(struct virq_info *irq_info)
302300
{
303301
enum hrt_isp_css_irq_status irq_status = hrt_isp_css_irq_status_error;
304302
irq_ID_t ID;
@@ -327,8 +325,7 @@ enum hrt_isp_css_irq_status virq_get_channel_signals(
327325
return irq_status;
328326
}
329327

330-
void virq_clear_info(
331-
virq_info_t *irq_info)
328+
void virq_clear_info(struct virq_info *irq_info)
332329
{
333330
irq_ID_t ID;
334331

@@ -341,7 +338,7 @@ void virq_clear_info(
341338
}
342339

343340
enum hrt_isp_css_irq_status virq_get_channel_id(
344-
virq_id_t *irq_id)
341+
enum virq_id *irq_id)
345342
{
346343
unsigned int irq_status = irq_reg_load(IRQ0_ID,
347344
_HRT_IRQ_CONTROLLER_STATUS_REG_IDX);
@@ -368,7 +365,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id(
368365

369366
/* Check whether we have an IRQ on one of the nested devices */
370367
for (ID = N_IRQ_ID - 1 ; ID > (irq_ID_t)0; ID--) {
371-
if (IRQ_NESTING_ID[ID] == (virq_id_t)idx) {
368+
if (IRQ_NESTING_ID[ID] == (enum virq_id)idx) {
372369
break;
373370
}
374371
}
@@ -405,7 +402,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id(
405402

406403
idx += IRQ_N_ID_OFFSET[ID];
407404
if (irq_id)
408-
*irq_id = (virq_id_t)idx;
405+
*irq_id = (enum virq_id)idx;
409406

410407
return status;
411408
}
@@ -433,7 +430,7 @@ static inline bool any_irq_channel_enabled(
433430
}
434431

435432
static inline irq_ID_t virq_get_irq_id(
436-
const virq_id_t irq_ID,
433+
const enum virq_id irq_ID,
437434
unsigned int *channel_ID)
438435
{
439436
irq_ID_t ID;

drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
#define IRQ2_ID_N_CHANNEL HIVE_ISYS_IRQ_NUM_BITS
4444
#define IRQ3_ID_N_CHANNEL HIVE_ISEL_IRQ_NUM_IRQS
4545

46-
typedef struct virq_info_s virq_info_t;
47-
typedef struct irq_controller_state_s irq_controller_state_t;
48-
49-
typedef enum {
46+
enum virq_id {
5047
virq_gpio_pin_0 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_0_BIT_ID,
5148
virq_gpio_pin_1 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_1_BIT_ID,
5249
virq_gpio_pin_2 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_2_BIT_ID,
@@ -67,13 +64,7 @@ typedef enum {
6764
virq_sp_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_SP_STREAM_MON_BIT_ID,
6865
virq_isp_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_STREAM_MON_BIT_ID,
6966
virq_mod_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_MOD_STREAM_MON_BIT_ID,
70-
#if defined(IS_ISP_2400_MAMOIADA_SYSTEM)
7167
virq_isp_pmem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID,
72-
#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM)
73-
virq_isys_2401 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID,
74-
#else
75-
#error "irq_local.h: 2400_SYSTEM must be one of {2400, 2401 }"
76-
#endif
7768
virq_isp_bamem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_BAMEM_ERROR_BIT_ID,
7869
virq_isp_dmem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_DMEM_ERROR_BIT_ID,
7970
virq_sp_icache_mem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_SP_ICACHE_MEM_ERROR_BIT_ID,
@@ -118,13 +109,13 @@ typedef enum {
118109
virq_isel_eol = IRQ3_ID_OFFSET + HIVE_ISEL_IRQ_SYNC_GEN_EOL_BIT_ID,
119110

120111
N_virq_id = IRQ_END_OFFSET
121-
} virq_id_t;
112+
};
122113

123-
struct virq_info_s {
114+
struct virq_info {
124115
hrt_data irq_status_reg[N_IRQ_ID];
125116
};
126117

127-
struct irq_controller_state_s {
118+
struct irq_controller_state {
128119
unsigned int irq_edge;
129120
unsigned int irq_mask;
130121
unsigned int irq_status;

drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
2727
\return none, state = IRQ[ID].state
2828
*/
29-
void irq_controller_get_state(
30-
const irq_ID_t ID,
31-
irq_controller_state_t *state);
29+
void irq_controller_get_state(const irq_ID_t ID,
30+
struct irq_controller_state *state);
3231

3332
/*! Write to a control register of IRQ[ID]
3433
@@ -137,7 +136,7 @@ bool any_virq_signal(void);
137136
\return none, VIRQ.channel[irq_ID].enable = en
138137
*/
139138
void cnd_virq_enable_channel(
140-
const virq_id_t irq_ID,
139+
const enum virq_id irq_ID,
141140
const bool en);
142141

143142
/*! Clear the state of all IRQ channels of the virtual super IRQ
@@ -152,8 +151,7 @@ void virq_clear_all(void);
152151
153152
\return none
154153
*/
155-
void virq_clear_info(
156-
virq_info_t *irq_info);
154+
void virq_clear_info(struct virq_info *irq_info);
157155

158156
/*! Return the ID of a signalling IRQ channel of the virtual super IRQ
159157
@@ -166,7 +164,7 @@ void virq_clear_info(
166164
\return state(IRQ[...])
167165
*/
168166
enum hrt_isp_css_irq_status virq_get_channel_id(
169-
virq_id_t *irq_id);
167+
enum virq_id *irq_id);
170168

171169
/*! Return the IDs of all signaling IRQ channels of the virtual super IRQ
172170
@@ -179,7 +177,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id(
179177
180178
\return (error(state(IRQ[...]))
181179
*/
182-
enum hrt_isp_css_irq_status virq_get_channel_signals(
183-
virq_info_t *irq_info);
180+
enum hrt_isp_css_irq_status
181+
virq_get_channel_signals(struct virq_info *irq_info);
184182

185183
#endif /* __IRQ_PUBLIC_H_INCLUDED__ */

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ void ia_css_debug_dump_debug_info(const char *context)
22282228
ia_css_debug_dump_isys_state();
22292229

22302230
{
2231-
irq_controller_state_t state;
2231+
struct irq_controller_state state;
22322232

22332233
irq_controller_get_state(IRQ2_ID, &state);
22342234

drivers/staging/media/atomisp/pci/sh_css.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,16 +1546,16 @@ enable_interrupts(enum ia_css_irq_type irq_type)
15461546

15471547
/* Enable SW interrupt 0, this is used to signal ISYS events */
15481548
cnd_virq_enable_channel(
1549-
(virq_id_t)(IRQ_SW_CHANNEL0_ID + IRQ_SW_CHANNEL_OFFSET),
1549+
(enum virq_id)(IRQ_SW_CHANNEL0_ID + IRQ_SW_CHANNEL_OFFSET),
15501550
true);
15511551
/* Enable SW interrupt 1, this is used to signal PSYS events */
15521552
cnd_virq_enable_channel(
1553-
(virq_id_t)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET),
1553+
(enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET),
15541554
true);
15551555
#if !defined(HAS_IRQ_MAP_VERSION_2)
15561556
/* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */
15571557
cnd_virq_enable_channel(
1558-
(virq_id_t)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET),
1558+
(enum virq_id)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET),
15591559
true);
15601560
virq_clear_all();
15611561
#endif
@@ -2549,7 +2549,7 @@ ia_css_uninit(void)
25492549
int ia_css_irq_translate(
25502550
unsigned int *irq_infos)
25512551
{
2552-
virq_id_t irq;
2552+
enum virq_id irq;
25532553
enum hrt_isp_css_irq_status status = hrt_isp_css_irq_status_more_irqs;
25542554
unsigned int infos = 0;
25552555

@@ -2622,7 +2622,7 @@ int ia_css_irq_enable(
26222622
enum ia_css_irq_info info,
26232623
bool enable)
26242624
{
2625-
virq_id_t irq = N_virq_id;
2625+
enum virq_id irq = N_virq_id;
26262626

26272627
IA_CSS_ENTER("info=%d, enable=%d", info, enable);
26282628

0 commit comments

Comments
 (0)