Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions module/include/linux/surface_aggregator/serial_hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef _LINUX_SURFACE_AGGREGATOR_SERIAL_HUB_H
#define _LINUX_SURFACE_AGGREGATOR_SERIAL_HUB_H

#include <linux/crc-ccitt.h>
#include <linux/crc-itu-t.h>
#include <linux/kref.h>
#include <linux/ktime.h>
#include <linux/list.h>
Expand Down Expand Up @@ -188,7 +188,7 @@ static_assert(sizeof(struct ssh_command) == 8);
*/
static inline u16 ssh_crc(const u8 *buf, size_t len)
{
return crc_ccitt_false(0xffff, buf, len);
return crc_itu_t(0xffff, buf, len);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions module/src/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ const void *ssam_device_get_match_data(const struct ssam_device *dev)
}
EXPORT_SYMBOL_GPL(ssam_device_get_match_data);

static int ssam_bus_match(struct device *dev, struct device_driver *drv)
static int ssam_bus_match(struct device *dev, const struct device_driver *drv)
{
struct ssam_device_driver *sdrv = to_ssam_device_driver(drv);
const struct ssam_device_driver *sdrv = to_ssam_device_driver(drv);
struct ssam_device *sdev = to_ssam_device(dev);

if (!is_ssam_device(dev))
Expand Down
6 changes: 2 additions & 4 deletions module/src/clients/surface_acpi_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
Expand Down Expand Up @@ -850,7 +850,7 @@ static int san_probe(struct platform_device *pdev)
return status;
}

static int san_remove(struct platform_device *pdev)
static void san_remove(struct platform_device *pdev)
{
acpi_handle san = ACPI_HANDLE(&pdev->dev);

Expand All @@ -864,8 +864,6 @@ static int san_remove(struct platform_device *pdev)
* all delayed works they may have spawned are run to completion.
*/
flush_workqueue(san_wq);

return 0;
}

static const struct acpi_device_id san_match[] = {
Expand Down
4 changes: 1 addition & 3 deletions module/src/clients/surface_aggregator_cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ static const struct file_operations ssam_controller_fops = {
.fasync = ssam_cdev_fasync,
.unlocked_ioctl = ssam_cdev_device_ioctl,
.compat_ioctl = ssam_cdev_device_ioctl,
.llseek = no_llseek,
};


Expand Down Expand Up @@ -714,7 +713,7 @@ static int ssam_dbg_device_probe(struct platform_device *pdev)
return 0;
}

static int ssam_dbg_device_remove(struct platform_device *pdev)
static void ssam_dbg_device_remove(struct platform_device *pdev)
{
struct ssam_cdev *cdev = platform_get_drvdata(pdev);
struct ssam_cdev_client *client;
Expand Down Expand Up @@ -757,7 +756,6 @@ static int ssam_dbg_device_remove(struct platform_device *pdev)
misc_deregister(&cdev->mdev);

ssam_cdev_put(cdev);
return 0;
}

static struct platform_device *ssam_cdev_device;
Expand Down
3 changes: 1 addition & 2 deletions module/src/clients/surface_aggregator_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,13 @@ static int ssam_platform_hub_probe(struct platform_device *pdev)
return status;
}

static int ssam_platform_hub_remove(struct platform_device *pdev)
static void ssam_platform_hub_remove(struct platform_device *pdev)
{
const struct software_node **nodes = platform_get_drvdata(pdev);

ssam_remove_clients(&pdev->dev);
set_secondary_fwnode(&pdev->dev, NULL);
software_node_unregister_node_group(nodes);
return 0;
}

static struct platform_driver ssam_platform_hub_driver = {
Expand Down
2 changes: 1 addition & 1 deletion module/src/clients/surface_aggregator_tabletsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/clients/surface_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/clients/surface_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
Expand Down
4 changes: 1 addition & 3 deletions module/src/clients/surface_dtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ static const struct file_operations surface_dtx_fops = {
.fasync = surface_dtx_fasync,
.unlocked_ioctl = surface_dtx_ioctl,
.compat_ioctl = surface_dtx_ioctl,
.llseek = no_llseek,
};


Expand Down Expand Up @@ -1168,10 +1167,9 @@ static int surface_dtx_platform_probe(struct platform_device *pdev)
return 0;
}

static int surface_dtx_platform_remove(struct platform_device *pdev)
static void surface_dtx_platform_remove(struct platform_device *pdev)
{
sdtx_device_destroy(platform_get_drvdata(pdev));
return 0;
}

static const struct acpi_device_id surface_dtx_acpi_match[] = {
Expand Down
2 changes: 1 addition & 1 deletion module/src/clients/surface_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/hid.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/clients/surface_hid_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/hid.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down
5 changes: 2 additions & 3 deletions module/src/clients/surface_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/hid.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down Expand Up @@ -271,10 +271,9 @@ static int surface_kbd_probe(struct platform_device *pdev)
return surface_hid_device_add(shid);
}

static int surface_kbd_remove(struct platform_device *pdev)
static void surface_kbd_remove(struct platform_device *pdev)
{
surface_hid_device_destroy(platform_get_drvdata(pdev));
return 0;
}

static const struct acpi_device_id surface_kbd_match[] = {
Expand Down
50 changes: 29 additions & 21 deletions module/src/clients/surface_platform_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (C) 2021-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_profile.h>
Expand All @@ -29,7 +29,7 @@ struct ssam_tmp_profile_info {

struct ssam_tmp_profile_device {
struct ssam_device *sdev;
struct platform_profile_handler handler;
struct device *ppdev;
};

SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_tmp_profile_get, struct ssam_tmp_profile_info, {
Expand Down Expand Up @@ -105,15 +105,13 @@ static int convert_profile_to_ssam(struct ssam_device *sdev, enum platform_profi
}
}

static int ssam_platform_profile_get(struct platform_profile_handler *pprof,
static int ssam_platform_profile_get(struct device *dev,
enum platform_profile_option *profile)
{
struct ssam_tmp_profile_device *tpd;
struct ssam_tmp_profile_device *tpd = dev_get_drvdata(dev);
enum ssam_tmp_profile tp;
int status;

tpd = container_of(pprof, struct ssam_tmp_profile_device, handler);

status = ssam_tmp_profile_get(tpd->sdev, &tp);
if (status)
return status;
Expand All @@ -126,21 +124,35 @@ static int ssam_platform_profile_get(struct platform_profile_handler *pprof,
return 0;
}

static int ssam_platform_profile_set(struct platform_profile_handler *pprof,
static int ssam_platform_profile_set(struct device *dev,
enum platform_profile_option profile)
{
struct ssam_tmp_profile_device *tpd;
struct ssam_tmp_profile_device *tpd = dev_get_drvdata(dev);
int tp;

tpd = container_of(pprof, struct ssam_tmp_profile_device, handler);

tp = convert_profile_to_ssam(tpd->sdev, profile);
if (tp < 0)
return tp;

return ssam_tmp_profile_set(tpd->sdev, tp);
}

static int ssam_platform_profile_probe(void *drvdata, unsigned long *choices)
{
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
set_bit(PLATFORM_PROFILE_BALANCED, choices);
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);

return 0;
}

static const struct platform_profile_ops ssam_platform_profile_ops = {
.probe = ssam_platform_profile_probe,
.profile_get = ssam_platform_profile_get,
.profile_set = ssam_platform_profile_set,
};

static int surface_platform_profile_probe(struct ssam_device *sdev)
{
struct ssam_tmp_profile_device *tpd;
Expand All @@ -150,22 +162,18 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
return -ENOMEM;

tpd->sdev = sdev;
ssam_device_set_drvdata(sdev, tpd);

tpd->handler.profile_get = ssam_platform_profile_get;
tpd->handler.profile_set = ssam_platform_profile_set;

set_bit(PLATFORM_PROFILE_LOW_POWER, tpd->handler.choices);
set_bit(PLATFORM_PROFILE_BALANCED, tpd->handler.choices);
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);

platform_profile_register(&tpd->handler);
return 0;
tpd->ppdev = platform_profile_register(&sdev->dev, "surface_platform_profile",
tpd, &ssam_platform_profile_ops);
return PTR_ERR_OR_ZERO(tpd->ppdev);
}

static void surface_platform_profile_remove(struct ssam_device *sdev)
{
platform_profile_remove();
struct ssam_tmp_profile_device *tpd = ssam_device_get_drvdata(sdev);

platform_profile_remove(tpd->ppdev);
}

static const struct ssam_device_id ssam_platform_profile_match[] = {
Expand Down
4 changes: 2 additions & 2 deletions module/src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);

/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */

static int ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf,
size_t n)
static size_t ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf,
size_t n)
{
struct ssam_controller *ctrl;

Expand Down
2 changes: 1 addition & 1 deletion module/src/ssh_msgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef _SURFACE_AGGREGATOR_SSH_MSGB_H
#define _SURFACE_AGGREGATOR_SSH_MSGB_H

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/types.h>

#include "../include/linux/surface_aggregator/controller.h"
Expand Down
2 changes: 1 addition & 1 deletion module/src/ssh_packet_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/atomic.h>
#include <linux/error-injection.h>
#include <linux/jiffies.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/ssh_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/compiler.h>
#include <linux/device.h>
#include <linux/types.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/ssh_request_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/atomic.h>
#include <linux/completion.h>
#include <linux/error-injection.h>
Expand Down
2 changes: 1 addition & 1 deletion module/src/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "../include/linux/surface_aggregator/serial_hub.h"

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/tracepoint.h>

TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_DATA_SEQ);
Expand Down