Skip to content

Commit

Permalink
platform/pddf: i2c: adapt for kernel 6.1 and bookworm
Browse files Browse the repository at this point in the history
   * 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 <rachandr@celestica.com>
  • Loading branch information
rchandramouli committed Oct 24, 2023
1 parent 0a797a2 commit f73b4d2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 18 deletions.
5 changes: 3 additions & 2 deletions platform/pddf/i2c/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ include /usr/share/dpkg/pkg-info.mk
export INSTALL_MOD_DIR:=extra

PYTHON ?= python3
PIP ?= pip3

PACKAGE_PRE_NAME := sonic-platform-pddf
KVERSION ?= $(shell uname -r)
Expand All @@ -37,7 +38,7 @@ clean:
build:
set -e; \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR); \
$(PYTHON) $(MOD_SRC_DIR)/setup.py build; \
$(PYTHON) -m build --wheel --no-isolation $(MOD_SRC_DIR); \
set +e

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

# Resuming debhelper scripts
Expand Down
4 changes: 1 addition & 3 deletions platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int board_i2c_cpld_probe(struct i2c_client *client,
return status;
}

static int board_i2c_cpld_remove(struct i2c_client *client)
static void board_i2c_cpld_remove(struct i2c_client *client)
{
/* Platform data is just a char string */
char *platdata = (char *)client->dev.platform_data;
Expand All @@ -247,8 +247,6 @@ static int board_i2c_cpld_remove(struct i2c_client *client)
{
kfree(platdata);
}

return 0;
}

static const struct i2c_device_id board_i2c_cpld_id[] = {
Expand Down
4 changes: 1 addition & 3 deletions platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ static int pddf_fan_probe(struct i2c_client *client,
return status;
}

static int pddf_fan_remove(struct i2c_client *client)
static void pddf_fan_remove(struct i2c_client *client)
{
int i = 0, ret = 0;
struct sensor_device_attribute *ptr = NULL;
Expand Down Expand Up @@ -590,8 +590,6 @@ static int pddf_fan_remove(struct i2c_client *client)
if (ret!=0)
printk(KERN_ERR "FAN post_remove function failed\n");
}

return 0;
}

/* Addresses to scan */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,10 @@ static int board_i2c_fpga_probe(struct i2c_client *client,
return status;
}

static int board_i2c_fpga_remove(struct i2c_client *client)
static void board_i2c_fpga_remove(struct i2c_client *client)
{
sysfs_remove_group(&client->dev.kobj, &fpgai2c_attribute_group);
board_i2c_fpga_remove_client(client);

return 0;
}

static const struct i2c_device_id board_i2c_fpga_id[] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,3 @@ module_exit (pddf_fpgapci_driver_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION ("PDDF Driver for FPGAPCI Logic I2C bus");
MODULE_SUPPORTED_DEVICE ("PDDF FPGAPCI Logic I2C bus");
4 changes: 1 addition & 3 deletions platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static int psu_probe(struct i2c_client *client,
return status;
}

static int psu_remove(struct i2c_client *client)
static void psu_remove(struct i2c_client *client)
{
int i=0, ret = 0;
struct psu_data *data = i2c_get_clientdata(client);
Expand Down Expand Up @@ -319,8 +319,6 @@ static int psu_remove(struct i2c_client *client)
if (ret!=0)
printk(KERN_ERR "FAN post_remove function failed\n");
}

return ret;
}

enum psu_intf
Expand Down
4 changes: 1 addition & 3 deletions platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int xcvr_probe(struct i2c_client *client,
return status;
}

static int xcvr_remove(struct i2c_client *client)
static void xcvr_remove(struct i2c_client *client)
{
int ret = 0;
struct xcvr_data *data = i2c_get_clientdata(client);
Expand Down Expand Up @@ -222,8 +222,6 @@ static int xcvr_remove(struct i2c_client *client)
if (ret!=0)
printk(KERN_ERR "FAN post_remove function failed\n");
}

return 0;
}

enum xcvr_intf
Expand Down

0 comments on commit f73b4d2

Please sign in to comment.