Skip to content

Commit 095bb13

Browse files
[PR:16737, PR:16739] platform-modules: pddf, broadcom/cel: adapt for kernel 6.1 and bookworm (#16954)
* sonic-platform-modules-cel: broadcom: adapt for kernel 6.1 and bookworm The i2c_driver->remove API declaration has been updated to return void instead of int, as part of cleanup patches in 6.1. More details can be referred from here: [1]. Update the remove API definition in the modules accordingly and cleanup variables that go unused from the remove API. Update python build commands for bookworm. The packaging based on calling setup.py is deprecated and using build module/pip utility is the recommended method for python packaging/installation. Further details can be referred to from here: [2], [3]. The build module is picky about the package information file, which needs to be either setup.py or pyproject.toml. Additionally, fix formatting inconsistencies in debian/changelog reported by `dh_installchangelogs` during the build. Tested the changes by compiling the changes as below: make sonic-slave-bash NOBUSTER=1 NOBULLSEYE=1 sudo dpkg -i target/debs/bookworm/linux-headers-6.1.0-11-2-*.deb cd platform/broadcom/sonic-platform-modules-cel KVERSION=6.1.0-11-2-amd64 dpkg-buildpackage Also verified the python scripts under the sonic-platform-modules-cel with pyflakes to ensure no new errors are flagged (with exception of unused modules). References: [1] - torvalds/linux@ed5c2f5f [2] - https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.htm [3] - 0b20a48 (Update Python build commands for Bookworm, 2023-09-07) Signed-off-by: Ramasamy Chandramouli <[email protected]> * platform/pddf: i2c: adapt for kernel 6.1 and bookworm * Fixup i2c_driver->remove API due to changes in the function prototype (ref: [1]). * Cleanup `MODULE_SUPPORTED_DEVICE` macros that were cleaned up in the upstream (ref: [2]). * Sanitize python packaging and installation using the `build` module instead of calling the setup.py directly (ref: [3]. [4]). Tested the changes by compiling pddf module as below: make sonic-slave-bash NOBUSTER=1 NOBULLSEYE=1 sudo dpkg -i target/debs/bookworm/linux-headers-6.1.0-11-2-*.deb cd platform/pddf/i2c KVERSION=6.1.0-11-2-amd64 dpkg-buildpackage References: [1] - torvalds/linux@ed5c2f5f [2] - torvalds/linux@6417f031 [2] - https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.htm [3] - 0b20a48 (Update Python build commands for Bookworm, 2023-09-07) Signed-off-by: Ramasamy Chandramouli <[email protected]> * platform/broadcom: include platform-modules-cel in builds With pddf modules patched for 6.1, platform-modules-cel can be compiled and included in the final image. Testing by building sonic-broadcom.bin/sonic-broadcom-dnx.bin. Signed-off-by: Ramasamy Chandramouli <[email protected]> * pddf/i2c: revert correct rootdir for pip install The pip install directory has been set to test-pkg1/ for testing the build and incorrectly retained as is. Revert this to the correct path $(PACKAGE_PRE_NAME). Signed-off-by: Ramasamy Chandramouli <[email protected]> * platform/broadcom: include pddf/modules-cel in the base package Without this change, the modules were built but not packaged in the final .bin. The final sonic-broadcom.bin has been tested for bootup on Celestica's Silverstone platform. admin@sonic:~$ uname -a Linux sonic 6.1.0-11-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) x86_64 GNU/Linux admin@sonic:~$ show platform summary Platform: x86_64-cel_silverstone-r0 HwSKU: Silverstone ASIC: broadcom ASIC Count: 1 Serial Number: R4009B2F062504LK200024 Model Number: N/A Hardware Revision: N/A admin@sonic:~$ show version | head SONiC Software Version: SONiC.g0aad6c67c-rachandr SONiC OS Version: 12 Distribution: Debian 12.2 Kernel: 6.1.0-11-2-amd64 Build commit: 0aad6c67c Build date: Thu Oct 26 07:13:47 UTC 2023 Built by: rachandr@AZUHPS14 Platform: x86_64-cel_silverstone-r0 Signed-off-by: Ramasamy Chandramouli <[email protected]> --------- Signed-off-by: Ramasamy Chandramouli <[email protected]>
1 parent 0fa30c1 commit 095bb13

File tree

20 files changed

+26
-56
lines changed

20 files changed

+26
-56
lines changed

platform/broadcom/one-image.mk

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ SONIC_ONE_IMAGE = sonic-broadcom.bin
44
$(SONIC_ONE_IMAGE)_MACHINE = broadcom
55
$(SONIC_ONE_IMAGE)_DEPENDENT_MACHINE = broadcom-dnx
66
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
7-
# TODO: re-enable once PPDF has been updated for bookworm
8-
#$(SONIC_ONE_IMAGE)_INSTALLS += $(PDDF_PLATFORM_MODULE)
7+
$(SONIC_ONE_IMAGE)_INSTALLS += $(PDDF_PLATFORM_MODULE)
98
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
109
$(SONIC_ONE_IMAGE)_INSTALLS += $(FLASHROM)
1110
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \

platform/broadcom/rules.dep

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ include $(PLATFORM_PATH)/sai.dep
55
# * Nokia
66
# * Dell
77
# * Accton
8-
# * Celestica
98
# * Juniper
109
# * Ragile
1110
include $(PLATFORM_PATH)/platform-modules-s6000.dep
@@ -15,7 +14,7 @@ include $(PLATFORM_PATH)/platform-modules-ingrasys.dep
1514
#include $(PLATFORM_PATH)/platform-modules-accton.dep
1615
include $(PLATFORM_PATH)/platform-modules-alphanetworks.dep
1716
include $(PLATFORM_PATH)/platform-modules-inventec.dep
18-
#include $(PLATFORM_PATH)/platform-modules-cel.dep
17+
include $(PLATFORM_PATH)/platform-modules-cel.dep
1918
include $(PLATFORM_PATH)/platform-modules-delta.dep
2019
include $(PLATFORM_PATH)/platform-modules-quanta.dep
2120
#include $(PLATFORM_PATH)/platform-modules-mitac.dep

platform/broadcom/rules.mk

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include $(PLATFORM_PATH)/sai.mk
44
# * Nokia
55
# * Dell
66
# * Accton
7-
# * Celestica
87
# * Juniper
98
# * Ragile
109
# * Ufispace
@@ -15,7 +14,7 @@ include $(PLATFORM_PATH)/platform-modules-arista.mk
1514
#include $(PLATFORM_PATH)/platform-modules-accton.mk
1615
include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk
1716
#include $(PLATFORM_PATH)/platform-modules-inventec.mk
18-
#include $(PLATFORM_PATH)/platform-modules-cel.mk
17+
include $(PLATFORM_PATH)/platform-modules-cel.mk
1918
#include $(PLATFORM_PATH)/platform-modules-delta.mk
2019
include $(PLATFORM_PATH)/platform-modules-quanta.mk
2120
##include $(PLATFORM_PATH)/platform-modules-mitac.mk

platform/broadcom/sonic-platform-modules-cel/belgite/modules/mc24lc64t.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,9 @@ static int mc24lc64t_probe(struct i2c_client *client,
142142
return err;
143143
}
144144

145-
static int mc24lc64t_remove(struct i2c_client *client)
145+
static void mc24lc64t_remove(struct i2c_client *client)
146146
{
147-
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
148147
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
149-
150-
return 0;
151148
}
152149

153150
static const struct i2c_device_id mc24lc64t_id[] = {

platform/broadcom/sonic-platform-modules-cel/debian/changelog

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ sonic-cel-platform-modules (0.6) unstable; urgency=low
2222
* Remove unused port-mode switch script. This should be done by hwsku config script.
2323
* Add script to turn off QSFP low power mode when boot up.
2424

25-
-- Pradchaya Phucharoen <[email protected]> Wed, 26 July 2017 10:43:00 +0700
25+
-- Pradchaya Phucharoen <[email protected]> Wed, 26 Jul 2017 10:43:00 +0700
2626

2727
sonic-cel-platform-modules (0.5) unstable; urgency=low
2828

2929
* Add port-mode switch script to support 100G 50G 10G_50G qsfp modes.
3030
* Fix garbage data when using sfputil to read QSFP-transceiver's eeprom.
3131
* Fix incorrect endian in eeprom read word data.
3232

33-
-- Pradchaya Phucharoen <[email protected]> Tue, 18 July 2017 11:30:00 +0700
33+
-- Pradchaya Phucharoen <[email protected]> Tue, 18 Jul 2017 11:30:00 +0700
3434

3535
sonic-cel-platform-modules (0.4) unstable; urgency=low
3636

3737
* Add support for DX010's fancontrol, automatic run-up and FIX bug lpmod
3838

39-
-- Pariwat Leamsumran <[email protected]> Thu, 14 June 2017 16:25:00 +0700
39+
-- Pariwat Leamsumran <[email protected]> Thu, 14 Jun 2017 16:25:00 +0700
4040

4141
sonic-cel-platform-modules (0.3) unstable; urgency=low
4242

platform/broadcom/sonic-platform-modules-cel/debian/rules

+5-7
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@ override_dh_auto_build:
1616
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
1717
if [ $$mod = "seastone2" ]; then \
1818
cd $(MOD_SRC_DIR)/services/platform_api; \
19-
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
19+
python3 -m build --wheel --no-isolation --outdir $(MOD_SRC_DIR)/$${mod}/modules; \
2020
continue; \
2121
fi; \
2222
if [ $$mod = "belgite" ]; then \
2323
cd $(MOD_SRC_DIR); \
2424
if [ -d $(MOD_SRC_DIR)/$${mod}/pddf ]; then \
25-
cd $(MOD_SRC_DIR)/$${mod}/pddf; \
26-
if [ -f sonic_platform_setup.py ]; then \
27-
python3 sonic_platform_setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/pddf; \
28-
echo "Finished makig pddf whl package for $$mod"; \
29-
fi; \
25+
cd $(MOD_SRC_DIR)/$${mod}/pddf; \
26+
python3 -m build --wheel --no-isolation --outdir $(MOD_SRC_DIR)/$${mod}/pddf; \
27+
echo "Finished making pddf whl package for $$mod"; \
3028
fi; \
3129
continue; \
3230
fi; \
3331
cd $(MOD_SRC_DIR)/$${mod}; \
34-
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
32+
python3 -m build --wheel --no-isolation --outdir $(MOD_SRC_DIR)/$${mod}/modules; \
3533
done)
3634

3735
override_dh_auto_install:

platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static const struct sensor_device_attribute *emc2305_fan_attrs[] = {
618618
* driver interface
619619
*/
620620

621-
static int emc2305_remove(struct i2c_client *client)
621+
static void emc2305_remove(struct i2c_client *client)
622622
{
623623
struct emc2305_data *data = i2c_get_clientdata(client);
624624
int fan_idx, i;
@@ -636,7 +636,6 @@ static int emc2305_remove(struct i2c_client *client)
636636
&emc2305_attr_common[i].dev_attr);
637637

638638
kfree(data);
639-
return 0;
640639
}
641640

642641

platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,13 @@ static int mc24lc64t_probe(struct i2c_client *client,
108108
return err;
109109
}
110110

111-
static int mc24lc64t_remove(struct i2c_client *client)
111+
static void mc24lc64t_remove(struct i2c_client *client)
112112
{
113113
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
114114

115115
i2c_unregister_device(drvdata->fake_client);
116116

117117
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
118-
119-
return 0;
120118
}
121119

122120
static const struct i2c_device_id mc24lc64t_id[] = {

platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static const struct sensor_device_attribute *emc2305_fan_attrs[] = {
638638
* driver interface
639639
*/
640640

641-
static int emc2305_remove(struct i2c_client *client)
641+
static void emc2305_remove(struct i2c_client *client)
642642
{
643643
struct emc2305_data *data = i2c_get_clientdata(client);
644644
int fan_idx, i;
@@ -656,7 +656,6 @@ static int emc2305_remove(struct i2c_client *client)
656656
&emc2305_attr_common[i].dev_attr);
657657

658658
kfree(data);
659-
return 0;
660659
}
661660

662661

platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,13 @@ static int mc24lc64t_probe(struct i2c_client *client,
108108
return err;
109109
}
110110

111-
static int mc24lc64t_remove(struct i2c_client *client)
111+
static void mc24lc64t_remove(struct i2c_client *client)
112112
{
113113
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
114114

115115
i2c_unregister_device(drvdata->fake_client);
116116

117117
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
118-
119-
return 0;
120118
}
121119

122120
static const struct i2c_device_id mc24lc64t_id[] = {

platform/broadcom/sonic-platform-modules-cel/seastone2/modules/mc24lc64t.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,9 @@ static int mc24lc64t_probe(struct i2c_client *client,
143143
return err;
144144
}
145145

146-
static int mc24lc64t_remove(struct i2c_client *client)
146+
static void mc24lc64t_remove(struct i2c_client *client)
147147
{
148-
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
149148
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
150-
151-
return 0;
152149
}
153150

154151
static const struct i2c_device_id mc24lc64t_id[] = {

platform/broadcom/sonic-platform-modules-cel/silverstone/modules/mc24lc64t.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,9 @@ static int mc24lc64t_probe(struct i2c_client *client,
143143
return err;
144144
}
145145

146-
static int mc24lc64t_remove(struct i2c_client *client)
146+
static void mc24lc64t_remove(struct i2c_client *client)
147147
{
148-
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
149148
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
150-
151-
return 0;
152149
}
153150

154151
static const struct i2c_device_id mc24lc64t_id[] = {

platform/pddf/i2c/debian/rules

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ include /usr/share/dpkg/pkg-info.mk
1313
export INSTALL_MOD_DIR:=extra
1414

1515
PYTHON ?= python3
16+
PIP ?= pip3
1617

1718
PACKAGE_PRE_NAME := sonic-platform-pddf
1819
KVERSION ?= $(shell uname -r)
@@ -37,7 +38,7 @@ clean:
3738
build:
3839
set -e; \
3940
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR); \
40-
$(PYTHON) $(MOD_SRC_DIR)/setup.py build; \
41+
$(PYTHON) -m build --wheel --no-isolation $(MOD_SRC_DIR); \
4142
set +e
4243

4344
binary: binary-arch binary-indep
@@ -59,7 +60,7 @@ binary-indep:
5960
# Need to take a backup of symvers file for compilation of custom modules in various platforms
6061
cp $(MOD_SRC_DIR)/Module.symvers $(MOD_SRC_DIR)/Module.symvers.PDDF; \
6162
cp -r $(MOD_SRC_DIR)/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)/usr/local/bin/; \
62-
$(PYTHON) $(MOD_SRC_DIR)/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME) --install-layout=deb; \
63+
$(PIP) install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME) $(MOD_SRC_DIR)/; \
6364
set +e
6465

6566
# Resuming debhelper scripts

platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static int board_i2c_cpld_probe(struct i2c_client *client,
237237
return status;
238238
}
239239

240-
static int board_i2c_cpld_remove(struct i2c_client *client)
240+
static void board_i2c_cpld_remove(struct i2c_client *client)
241241
{
242242
/* Platform data is just a char string */
243243
char *platdata = (char *)client->dev.platform_data;
@@ -247,8 +247,6 @@ static int board_i2c_cpld_remove(struct i2c_client *client)
247247
{
248248
kfree(platdata);
249249
}
250-
251-
return 0;
252250
}
253251

254252
static const struct i2c_device_id board_i2c_cpld_id[] = {

platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ static int pddf_fan_probe(struct i2c_client *client,
550550
return status;
551551
}
552552

553-
static int pddf_fan_remove(struct i2c_client *client)
553+
static void pddf_fan_remove(struct i2c_client *client)
554554
{
555555
int i = 0, ret = 0;
556556
struct sensor_device_attribute *ptr = NULL;
@@ -590,8 +590,6 @@ static int pddf_fan_remove(struct i2c_client *client)
590590
if (ret!=0)
591591
printk(KERN_ERR "FAN post_remove function failed\n");
592592
}
593-
594-
return 0;
595593
}
596594

597595
/* Addresses to scan */

platform/pddf/i2c/modules/fpgai2c/driver/pddf_fpgai2c_driver.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,10 @@ static int board_i2c_fpga_probe(struct i2c_client *client,
184184
return status;
185185
}
186186

187-
static int board_i2c_fpga_remove(struct i2c_client *client)
187+
static void board_i2c_fpga_remove(struct i2c_client *client)
188188
{
189189
sysfs_remove_group(&client->dev.kobj, &fpgai2c_attribute_group);
190190
board_i2c_fpga_remove_client(client);
191-
192-
return 0;
193191
}
194192

195193
static const struct i2c_device_id board_i2c_fpga_id[] = {

platform/pddf/i2c/modules/fpgapci/driver/pddf_fpgapci_driver.c

-1
Original file line numberDiff line numberDiff line change
@@ -349,4 +349,3 @@ module_exit (pddf_fpgapci_driver_exit);
349349
MODULE_LICENSE("GPL");
350350
MODULE_AUTHOR("Broadcom");
351351
MODULE_DESCRIPTION ("PDDF Driver for FPGAPCI Logic I2C bus");
352-
MODULE_SUPPORTED_DEVICE ("PDDF FPGAPCI Logic I2C bus");

platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static int psu_probe(struct i2c_client *client,
279279
return status;
280280
}
281281

282-
static int psu_remove(struct i2c_client *client)
282+
static void psu_remove(struct i2c_client *client)
283283
{
284284
int i=0, ret = 0;
285285
struct psu_data *data = i2c_get_clientdata(client);
@@ -319,8 +319,6 @@ static int psu_remove(struct i2c_client *client)
319319
if (ret!=0)
320320
printk(KERN_ERR "FAN post_remove function failed\n");
321321
}
322-
323-
return ret;
324322
}
325323

326324
enum psu_intf

platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int xcvr_probe(struct i2c_client *client,
189189
return status;
190190
}
191191

192-
static int xcvr_remove(struct i2c_client *client)
192+
static void xcvr_remove(struct i2c_client *client)
193193
{
194194
int ret = 0;
195195
struct xcvr_data *data = i2c_get_clientdata(client);
@@ -222,8 +222,6 @@ static int xcvr_remove(struct i2c_client *client)
222222
if (ret!=0)
223223
printk(KERN_ERR "FAN post_remove function failed\n");
224224
}
225-
226-
return 0;
227225
}
228226

229227
enum xcvr_intf

0 commit comments

Comments
 (0)