Skip to content

Commit

Permalink
chore(driver): avoid ISO C mixed declarations and code errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Jan 22, 2025
1 parent 5cc6f10 commit b5a9c14
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ struct event_data_t {
} event_info;
};

// Data related to hotplug event
struct hotplug_data_t {
long sd_action;
long cpu;
};

/*
* FORWARD DECLARATIONS
*/
Expand Down Expand Up @@ -2767,18 +2773,13 @@ static char *ppm_devnode(struct device *dev, mode_t *mode)
}
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20) */

struct hotplug_st {
long sd_action;
long cpu;
};

static void do_cpu_callback(void *payload) {
struct ppm_ring_buffer_context *ring;
struct ppm_consumer_t *consumer;
struct event_data_t event_data;
struct hotplug_st *st;
struct hotplug_data_t *st;

st = (struct hotplug_st *)payload;
st = (struct hotplug_data_t *)payload;
if(st->sd_action != 0) {
rcu_read_lock();

Expand Down Expand Up @@ -2809,15 +2810,15 @@ static void do_cpu_callback(void *payload) {

static int scap_cpu_online(unsigned int cpu) {
vpr_info("scap_cpu_online on cpu %d\n", cpu);
struct hotplug_st st;
struct hotplug_data_t st;
st.sd_action = 1;
st.cpu = cpu;
return smp_call_function_single(0, do_cpu_callback, &st, 1);
}

static int scap_cpu_offline(unsigned int cpu) {
vpr_info("scap_cpu_offline on cpu %d\n", cpu);
struct hotplug_st st;
struct hotplug_data_t st;
st.sd_action = 2;
st.cpu = cpu;
return smp_call_function_single(0, do_cpu_callback, &st, 1);
Expand Down

0 comments on commit b5a9c14

Please sign in to comment.