Skip to contentSkip to conversation

gpu: convert to use new I2C API

PATCH In review Wolfram Sang 4 participants 13 messages Mar 26, 2020 – Mar 28, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover gpu: convert to use new I2C API

We are deprecating calls which return NULL in favor of new variants which return an ERR_PTR. Only build tested.

Wolfram Sang (6):
drm/amdgpu: convert to use i2c_new_client_device() drm/gma500: convert to use i2c_new_client_device() drm/i2c/sil164: convert to use i2c_new_client_device() drm/i2c/tda998x: convert to use i2c_new_client_device() drm/nouveau/therm: convert to use i2c_new_client_device() drm/radeon: convert to use i2c_new_client_device()

 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c        | 2 +-
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c     | 8 ++++----
 drivers/gpu/drm/i2c/sil164_drv.c               | 7 +++++--
 drivers/gpu/drm/i2c/tda998x_drv.c              | 6 +++---
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/ic.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_atombios.c       | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c        | 4 ++--
 7 files changed, 19 insertions(+), 16 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/6 drm/amdgpu: convert to use i2c_new_client_device()

Move away from the deprecated API.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +1 -1
index ba1bb95a3cf9..0e8018c9aa8e 100644
@@ -856,7 +856,7 @@ void amdgpu_add_thermal_controller(struct amdgpu_device *adev)
 				const char *name = pp_lib_thermal_controller_names[controller->ucType];
 				info.addr = controller->ucI2cAddress >> 1;
 				strlcpy(info.type, name, sizeof(info.type));
-				i2c_new_device(&adev->pm.i2c_bus->adapter, &info);
+				i2c_new_client_device(&adev->pm.i2c_bus->adapter, &info);
 			}
 		} else {
 			DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n",
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/6 drm/gma500: convert to use i2c_new_client_device()

In reply to Wolfram Sang

Move away from the deprecated API and return the shiny new ERRPTR where useful.

---
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c +4 -4
index 9e8224456ea2..71574063c63e 100644
@@ -747,11 +747,11 @@ static int cmi_lcd_hack_create_device(void)
 		return -EINVAL;
 	}
 
-	client = i2c_new_device(adapter, &info);
-	if (!client) {
-		pr_err("%s: i2c_new_device() failed\n", __func__);
+	client = i2c_new_client_device(adapter, &info);
+	if (IS_ERR(client)) {
+		pr_err("%s: creating I2C device failed\n", __func__);
 		i2c_put_adapter(adapter);
-		return -EINVAL;
+		return PTR_ERR(client);
 	}
 
 	return 0;
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/6 drm/i2c/sil164: convert to use i2c_new_client_device()

In reply to Wolfram Sang

Move away from the deprecated API and return the shiny new ERRPTR where useful.

---
 drivers/gpu/drm/i2c/sil164_drv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i2c/sil164_drv.c +5 -2
index a839f78a4c8a..741886b54419 100644
@@ -393,7 +393,7 @@ sil164_detect_slave(struct i2c_client *client)
 		return NULL;
 	}
 
-	return i2c_new_device(adap, &info);
+	return i2c_new_client_device(adap, &info);
 }
 
 static int
@@ -402,6 +402,7 @@ sil164_encoder_init(struct i2c_client *client,
 		    struct drm_encoder_slave *encoder)
 {
 	struct sil164_priv *priv;
+	struct i2c_client *slave_client;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -410,7 +411,9 @@ sil164_encoder_init(struct i2c_client *client,
 	encoder->slave_priv = priv;
 	encoder->slave_funcs = &sil164_encoder_funcs;
 
-	priv->duallink_slave = sil164_detect_slave(client);
+	slave_client = sil164_detect_slave(client);
+	if (!IS_ERR(slave_client))
+		priv->duallink_slave = slave_client;
 
 	return 0;
 }
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/6 drm/i2c/tda998x: convert to use i2c_new_client_device()

In reply to Wolfram Sang

Move away from the deprecated API and return the shiny new ERRPTR where useful.

---
 drivers/gpu/drm/i2c/tda998x_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i2c/tda998x_drv.c +3 -3
index c3332209f27a..d9a548d0273c 100644
@@ -1949,9 +1949,9 @@ static int tda998x_create(struct device *dev)
 	cec_info.platform_data = &priv->cec_glue;
 	cec_info.irq = client->irq;
 
-	priv->cec = i2c_new_device(client->adapter, &cec_info);
-	if (!priv->cec) {
-		ret = -ENODEV;
+	priv->cec = i2c_new_client_device(client->adapter, &cec_info);
+	if (IS_ERR(priv->cec)) {
+		ret = PTR_ERR(priv->cec);
 		goto fail;
 	}
 
Signature · 1 line
2.20.1
#5 lore raw

PATCH 5/6 drm/nouveau/therm: convert to use i2c_new_client_device()

In reply to Wolfram Sang

Move away from the deprecated API and return the shiny new ERRPTR where useful.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/ic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/therm/ic.c +2 -2
index 03b355dabab3..abf3eda683f0 100644
@@ -36,8 +36,8 @@ probe_monitoring_device(struct nvkm_i2c_bus *bus,
 
 	request_module("%s%s", I2C_MODULE_PREFIX, info->type);
 
-	client = i2c_new_device(&bus->i2c, info);
-	if (!client)
+	client = i2c_new_client_device(&bus->i2c, info);
+	if (IS_ERR(client))
 		return false;
 
 	if (!client->dev.driver ||
Signature · 1 line
2.20.1
#6 lore raw

PATCH 6/6 drm/radeon: convert to use i2c_new_client_device()

In reply to Wolfram Sang

Move away from the deprecated API.

---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
index 848ef68d9086..5d2591725189 100644
@@ -2111,7 +2111,7 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
 								    ucOverdriveThermalController];
 			info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
 			strlcpy(info.type, name, sizeof(info.type));
-			i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+			i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
 		}
 	}
 	num_modes = power_info->info.ucNumOfPowerModeEntries;
@@ -2351,7 +2351,7 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
 				const char *name = pp_lib_thermal_controller_names[controller->ucType];
 				info.addr = controller->ucI2cAddress >> 1;
 				strlcpy(info.type, name, sizeof(info.type));
-				i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+				i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
 			}
 		} else {
 			DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n",
drivers/gpu/drm/radeon/radeon_combios.c +2 -2
index c3e49c973812..d3c04df7e75d 100644
@@ -2704,7 +2704,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
 				const char *name = thermal_controller_names[thermal_controller];
 				info.addr = i2c_addr >> 1;
 				strlcpy(info.type, name, sizeof(info.type));
-				i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+				i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
 			}
 		}
 	} else {
@@ -2721,7 +2721,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
 				const char *name = "f75375";
 				info.addr = 0x28;
 				strlcpy(info.type, name, sizeof(info.type));
-				i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+				i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
 				DRM_INFO("Possible %s thermal controller at 0x%02x\n",
 					 name, info.addr);
 			}
Signature · 1 line
2.20.1
Acked-by on v1 6/6
#7 lore raw

Re: [PATCH 6/6] drm/radeon: convert to use i2c_new_client_device()

Quoted 4 lines · Wolfram Sang

Move away from the deprecated API.

patches 1,6, are:

Quoted 56 lines
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
index 848ef68d9086..5d2591725189 100644
@@ -2111,7 +2111,7 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
                                                                    ucOverdriveThermalController];
                        info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
                        strlcpy(info.type, name, sizeof(info.type));
-                       i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                       i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                }
        }
        num_modes = power_info->info.ucNumOfPowerModeEntries;
@@ -2351,7 +2351,7 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
                                const char *name = pp_lib_thermal_controller_names[controller->ucType];
                                info.addr = controller->ucI2cAddress >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                } else {
                        DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n",
drivers/gpu/drm/radeon/radeon_combios.c +2 -3
index c3e49c973812..d3c04df7e75d 100644
@@ -2704,7 +2704,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = thermal_controller_names[thermal_controller];
                                info.addr = i2c_addr >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                }
        } else {
@@ -2721,7 +2721,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = "f75375";
                                info.addr = 0x28;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                                DRM_INFO("Possible %s thermal controller at 0x%02x\n",
                                         name, info.addr);
                        }
--

2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH 6/6] drm/radeon: convert to use i2c_new_client_device()

Quoted 9 lines · Alex Deucher
Quoted 4 lines · Wolfram Sang

Move away from the deprecated API.

patches 1,6, are:

Should we commit all to drm-misc-next?

Sam

Quoted 61 lines
Quoted 53 lines
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
index 848ef68d9086..5d2591725189 100644
@@ -2111,7 +2111,7 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
                                                                    ucOverdriveThermalController];
                        info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
                        strlcpy(info.type, name, sizeof(info.type));
-                       i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                       i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                }
        }
        num_modes = power_info->info.ucNumOfPowerModeEntries;
@@ -2351,7 +2351,7 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
                                const char *name = pp_lib_thermal_controller_names[controller->ucType];
                                info.addr = controller->ucI2cAddress >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                } else {
                        DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n",
drivers/gpu/drm/radeon/radeon_combios.c +2 -3
index c3e49c973812..d3c04df7e75d 100644
@@ -2704,7 +2704,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = thermal_controller_names[thermal_controller];
                                info.addr = i2c_addr >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                }
        } else {
@@ -2721,7 +2721,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = "f75375";
                                info.addr = 0x28;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                                DRM_INFO("Possible %s thermal controller at 0x%02x\n",
                                         name, info.addr);
                        }
--

2.20.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCH 6/6] drm/radeon: convert to use i2c_new_client_device()

Quoted 5 lines · Sam Ravnborg
Quoted 3 lines · Alex Deucher
Quoted 1 line · Wolfram Sang
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Move away from the deprecated API.

patches 1,6, are:

Should we commit all to drm-misc-next?

I'm fine to see it go through whatever tree makes sense.

Alex

Quoted 65 lines

Sam

Quoted 61 lines
Quoted 53 lines
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
index 848ef68d9086..5d2591725189 100644
@@ -2111,7 +2111,7 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
                                                                    ucOverdriveThermalController];
                        info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
                        strlcpy(info.type, name, sizeof(info.type));
-                       i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                       i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                }
        }
        num_modes = power_info->info.ucNumOfPowerModeEntries;
@@ -2351,7 +2351,7 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
                                const char *name = pp_lib_thermal_controller_names[controller->ucType];
                                info.addr = controller->ucI2cAddress >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                } else {
                        DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n",
drivers/gpu/drm/radeon/radeon_combios.c +2 -3
index c3e49c973812..d3c04df7e75d 100644
@@ -2704,7 +2704,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = thermal_controller_names[thermal_controller];
                                info.addr = i2c_addr >> 1;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                        }
                }
        } else {
@@ -2721,7 +2721,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                const char *name = "f75375";
                                info.addr = 0x28;
                                strlcpy(info.type, name, sizeof(info.type));
-                               i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
+                               i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info);
                                DRM_INFO("Possible %s thermal controller at 0x%02x\n",
                                         name, info.addr);
                        }
--

2.20.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

Re: [PATCH 6/6] drm/radeon: convert to use i2c_new_client_device()

Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Move away from the deprecated API.

patches 1,6, are:

Should we commit all to drm-misc-next?

I'm fine to see it go through whatever tree makes sense.

I'd suggest drm-misc-next to minimize merge conflicts. But I can take it via I2C tree, too, if desired.

#11 lore raw

Re: [PATCH 6/6] drm/radeon: convert to use i2c_new_client_device()

Quoted 5 lines · Wolfram Sang
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Move away from the deprecated API.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

patches 1,6, are:

Should we commit all to drm-misc-next?

I'm fine to see it go through whatever tree makes sense.

I'd suggest drm-misc-next to minimize merge conflicts. But I can take it via I2C tree, too, if desired.

If no-one else speaks up until tomorrow I will land them in drm-misc-next.
Just wanted to make sure it was OK.

Sam

#12 lore raw
In reply to Wolfram Sang
Quoted 11 lines · Wolfram Sang

We are deprecating calls which return NULL in favor of new variants which return an ERR_PTR. Only build tested.

Wolfram Sang (6):
drm/amdgpu: convert to use i2c_new_client_device() drm/gma500: convert to use i2c_new_client_device() drm/i2c/sil164: convert to use i2c_new_client_device() drm/i2c/tda998x: convert to use i2c_new_client_device() drm/nouveau/therm: convert to use i2c_new_client_device() drm/radeon: convert to use i2c_new_client_device()

With the ack from Alex I went ahead and applied the patches to drm-misc-next.

Sam

Quoted 17 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c        | 2 +-
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c     | 8 ++++----
 drivers/gpu/drm/i2c/sil164_drv.c               | 7 +++++--
 drivers/gpu/drm/i2c/tda998x_drv.c              | 6 +++---
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/ic.c | 4 ++--
 drivers/gpu/drm/radeon/radeon_atombios.c       | 4 ++--
 drivers/gpu/drm/radeon/radeon_combios.c        | 4 ++--
 7 files changed, 19 insertions(+), 16 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel