]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: sparx5: move calendar initialization to probe
authorDaniel Machon <daniel.machon@microchip.com>
Fri, 27 Feb 2026 14:56:43 +0000 (15:56 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Mar 2026 02:46:21 +0000 (18:46 -0800)
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>
drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c
drivers/net/ethernet/microchip/sparx5/sparx5_main.c
drivers/net/ethernet/microchip/sparx5/sparx5_main.h

index 8c67ff1d411ba3610d057a9f6beaeb20d4117a7a..35815fb58080f0a3baf17636eb9a5051344573f6 100644 (file)
@@ -151,7 +151,7 @@ enum sparx5_cal_bw sparx5_get_port_cal_speed(struct sparx5 *sparx5, u32 portno)
 }
 
 /* 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;
@@ -578,7 +578,7 @@ update_err:
 }
 
 /* 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;
@@ -610,3 +610,14 @@ cal_out:
        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);
+}
index cc0c32d7e886f09034506d793e53937898104219..46ddd7a5fb61a88224341e8783e110fd0d33ef76 100644 (file)
@@ -735,14 +735,6 @@ static int sparx5_start(struct sparx5 *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 */
@@ -956,6 +948,12 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
                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");
index 97d53e229ad6973ccf19112d378286189d35e3ce..6a745bb71b5c533e1ae370391539ed90f4c71963 100644 (file)
@@ -504,8 +504,7 @@ int sparx5_vlan_vid_del(struct sparx5_port *port, u16 vid);
 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);