Move the calendar initialization from sparx5_start() to probe() by
creating a new sparx5_calendar_init() wrapper function that calls both
sparx5_config_auto_calendar() and sparx5_config_dsm_calendar().
Calendar initialization does not require cleanup.
Also, make the individual calendar config functions static since they
are now only called from within sparx5_calendar.c.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20260227-sparx5-init-deinit-v2-5-10ba54ccf005@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
}
/* Auto configure the QSYS calendar based on port configuration */
-int sparx5_config_auto_calendar(struct sparx5 *sparx5)
+static int sparx5_config_auto_calendar(struct sparx5 *sparx5)
{
const struct sparx5_consts *consts = sparx5->data->consts;
u32 cal[7], value, idx, portno;
}
/* Configure the DSM calendar based on port configuration */
-int sparx5_config_dsm_calendar(struct sparx5 *sparx5)
+static int sparx5_config_dsm_calendar(struct sparx5 *sparx5)
{
const struct sparx5_ops *ops = sparx5->data->ops;
int taxi;
kfree(data);
return err;
}
+
+int sparx5_calendar_init(struct sparx5 *sparx5)
+{
+ int err;
+
+ err = sparx5_config_auto_calendar(sparx5);
+ if (err)
+ return err;
+
+ return sparx5_config_dsm_calendar(sparx5);
+}
/* Enable queue limitation watermarks */
sparx5_qlim_set(sparx5);
- err = sparx5_config_auto_calendar(sparx5);
- if (err)
- return err;
-
- err = sparx5_config_dsm_calendar(sparx5);
- if (err)
- return err;
-
sparx5_board_init(sparx5);
/* Start Frame DMA with fallback to register based INJ/XTR */
goto cleanup_ports;
}
+ err = sparx5_calendar_init(sparx5);
+ if (err) {
+ dev_err(sparx5->dev, "Failed to initialize calendar\n");
+ goto cleanup_ports;
+ }
+
err = sparx5_qos_init(sparx5);
if (err) {
dev_err(sparx5->dev, "Failed to initialize QoS\n");
void sparx5_vlan_port_apply(struct sparx5 *sparx5, struct sparx5_port *port);
/* sparx5_calendar.c */
-int sparx5_config_auto_calendar(struct sparx5 *sparx5);
-int sparx5_config_dsm_calendar(struct sparx5 *sparx5);
+int sparx5_calendar_init(struct sparx5 *sparx5);
int sparx5_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
struct sparx5_calendar_data *data);
u32 sparx5_cal_speed_to_value(enum sparx5_cal_bw speed);