Skip to content

Commit 846b065

Browse files
committed
Merge tag 'platform-drivers-x86-v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - various Microsoft Surface support fixes - one fix for the INT3472 driver * tag 'platform-drivers-x86-v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: int3472: Avoid crash in unregistering regulator gpio platform/surface: aggregator_tabletsw: Add support for book mode in POS subsystem platform/surface: aggregator_tabletsw: Add support for book mode in KIP subsystem platform/surface: aggregator: Allow completion work-items to be executed in parallel platform/surface: aggregator: Make to_ssam_device_driver() respect constness
2 parents fa56e0e + fb109fb commit 846b065

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

drivers/platform/surface/aggregator/controller.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static int ssam_cplt_init(struct ssam_cplt *cplt, struct device *dev)
825825

826826
cplt->dev = dev;
827827

828-
cplt->wq = create_workqueue(SSAM_CPLT_WQ_NAME);
828+
cplt->wq = alloc_workqueue(SSAM_CPLT_WQ_NAME, WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
829829
if (!cplt->wq)
830830
return -ENOMEM;
831831

drivers/platform/surface/surface_aggregator_tabletsw.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ enum ssam_kip_cover_state {
210210
SSAM_KIP_COVER_STATE_LAPTOP = 0x03,
211211
SSAM_KIP_COVER_STATE_FOLDED_CANVAS = 0x04,
212212
SSAM_KIP_COVER_STATE_FOLDED_BACK = 0x05,
213+
SSAM_KIP_COVER_STATE_BOOK = 0x06,
213214
};
214215

215216
static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
@@ -231,6 +232,9 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
231232
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
232233
return "folded-back";
233234

235+
case SSAM_KIP_COVER_STATE_BOOK:
236+
return "book";
237+
234238
default:
235239
dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state->state);
236240
return "<unknown>";
@@ -244,6 +248,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw,
244248
case SSAM_KIP_COVER_STATE_DISCONNECTED:
245249
case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
246250
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
251+
case SSAM_KIP_COVER_STATE_BOOK:
247252
return true;
248253

249254
case SSAM_KIP_COVER_STATE_CLOSED:
@@ -335,6 +340,7 @@ enum ssam_pos_state_cover {
335340
SSAM_POS_COVER_LAPTOP = 0x03,
336341
SSAM_POS_COVER_FOLDED_CANVAS = 0x04,
337342
SSAM_POS_COVER_FOLDED_BACK = 0x05,
343+
SSAM_POS_COVER_BOOK = 0x06,
338344
};
339345

340346
enum ssam_pos_state_sls {
@@ -367,6 +373,9 @@ static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 stat
367373
case SSAM_POS_COVER_FOLDED_BACK:
368374
return "folded-back";
369375

376+
case SSAM_POS_COVER_BOOK:
377+
return "book";
378+
370379
default:
371380
dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
372381
return "<unknown>";
@@ -416,6 +425,7 @@ static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 s
416425
case SSAM_POS_COVER_DISCONNECTED:
417426
case SSAM_POS_COVER_FOLDED_CANVAS:
418427
case SSAM_POS_COVER_FOLDED_BACK:
428+
case SSAM_POS_COVER_BOOK:
419429
return true;
420430

421431
case SSAM_POS_COVER_CLOSED:

drivers/platform/x86/intel/int3472/clk_and_regulator.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472,
101101

102102
int3472->clock.ena_gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
103103
"int3472,clk-enable");
104-
if (IS_ERR(int3472->clock.ena_gpio))
105-
return dev_err_probe(int3472->dev, PTR_ERR(int3472->clock.ena_gpio),
106-
"getting clk-enable GPIO\n");
104+
if (IS_ERR(int3472->clock.ena_gpio)) {
105+
ret = PTR_ERR(int3472->clock.ena_gpio);
106+
int3472->clock.ena_gpio = NULL;
107+
return dev_err_probe(int3472->dev, ret, "getting clk-enable GPIO\n");
108+
}
107109

108110
if (polarity == GPIO_ACTIVE_LOW)
109111
gpiod_toggle_active_low(int3472->clock.ena_gpio);
@@ -199,8 +201,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
199201
int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
200202
"int3472,regulator");
201203
if (IS_ERR(int3472->regulator.gpio)) {
202-
dev_err(int3472->dev, "Failed to get regulator GPIO line\n");
203-
return PTR_ERR(int3472->regulator.gpio);
204+
ret = PTR_ERR(int3472->regulator.gpio);
205+
int3472->regulator.gpio = NULL;
206+
return dev_err_probe(int3472->dev, ret, "getting regulator GPIO\n");
204207
}
205208

206209
/* Ensure the pin is in output mode and non-active state */

include/linux/surface_aggregator/device.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ static inline bool is_ssam_device(struct device *d)
243243
* Return: Returns the pointer to the &struct ssam_device_driver wrapping the
244244
* given device driver @d.
245245
*/
246-
static inline
247-
struct ssam_device_driver *to_ssam_device_driver(struct device_driver *d)
248-
{
249-
return container_of(d, struct ssam_device_driver, driver);
250-
}
246+
#define to_ssam_device_driver(d) container_of_const(d, struct ssam_device_driver, driver)
251247

252248
const struct ssam_device_id *ssam_device_id_match(const struct ssam_device_id *table,
253249
const struct ssam_device_uid uid);

0 commit comments

Comments
 (0)