Skip to content

Commit f101a7a

Browse files
committed
Unify comment style
1 parent 5d45e5e commit f101a7a

17 files changed

+302
-267
lines changed

examples/dtx.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ int main()
2626
return -1;
2727
}
2828

29-
// enable events
29+
/* Enable events. */
3030
status = ioctl(fd, SDTX_IOCTL_EVENTS_ENABLE);
3131
if (status < 0) {
3232
printf("error: Failed to enable events: %s\n", strerror(errno));
3333
return -1;
3434
}
3535

36-
// read events
36+
/* Read events. */
3737
while (true) {
3838
struct sdtx_event *event = (struct sdtx_event *)&buffer[0];
3939
ssize_t n;
@@ -52,7 +52,7 @@ int main()
5252
event->code, event->length);
5353

5454
if (event->code == SDTX_EVENT_REQUEST) {
55-
// send confirmation command
55+
/* Send confirmation command. */
5656
status = ioctl(fd, SDTX_IOCTL_LATCH_CONFIRM);
5757
if (status < 0) {
5858
printf("error: Failed to send command: %s\n",

module/include/linux/surface_aggregator/serial_hub.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,15 @@ struct ssam_span {
292292
* Windows driver.
293293
*/
294294
enum ssam_ssh_tc {
295-
// category 0x00 is invalid for EC use
296-
SSAM_SSH_TC_SAM = 0x01, // generic system functionality, real-time clock
297-
SSAM_SSH_TC_BAT = 0x02, // battery/power subsystem
298-
SSAM_SSH_TC_TMP = 0x03, // thermal subsystem
295+
/* Category 0x00 is invalid for EC use. */
296+
SSAM_SSH_TC_SAM = 0x01, /* Generic system functionality, real-time clock. */
297+
SSAM_SSH_TC_BAT = 0x02, /* Battery/power subsystem. */
298+
SSAM_SSH_TC_TMP = 0x03, /* Thermal subsystem. */
299299
SSAM_SSH_TC_PMC = 0x04,
300300
SSAM_SSH_TC_FAN = 0x05,
301301
SSAM_SSH_TC_PoM = 0x06,
302302
SSAM_SSH_TC_DBG = 0x07,
303-
SSAM_SSH_TC_KBD = 0x08, // legacy keyboard (Laptop 1/2)
303+
SSAM_SSH_TC_KBD = 0x08, /* Legacy keyboard (Laptop 1/2). */
304304
SSAM_SSH_TC_FWU = 0x09,
305305
SSAM_SSH_TC_UNI = 0x0a,
306306
SSAM_SSH_TC_LPC = 0x0b,
@@ -309,11 +309,11 @@ enum ssam_ssh_tc {
309309
SSAM_SSH_TC_KIP = 0x0e,
310310
SSAM_SSH_TC_EXT = 0x0f,
311311
SSAM_SSH_TC_BLD = 0x10,
312-
SSAM_SSH_TC_BAS = 0x11, // detachment system (Surface Book 2/3)
312+
SSAM_SSH_TC_BAS = 0x11, /* Detachment system (Surface Book 2/3). */
313313
SSAM_SSH_TC_SEN = 0x12,
314314
SSAM_SSH_TC_SRQ = 0x13,
315315
SSAM_SSH_TC_MCU = 0x14,
316-
SSAM_SSH_TC_HID = 0x15, // generic HID input subsystem
316+
SSAM_SSH_TC_HID = 0x15, /* Generic HID input subsystem. */
317317
SSAM_SSH_TC_TCH = 0x16,
318318
SSAM_SSH_TC_BKL = 0x17,
319319
SSAM_SSH_TC_TAM = 0x18,
@@ -325,7 +325,7 @@ enum ssam_ssh_tc {
325325
SSAM_SSH_TC_AUD = 0x1e,
326326
SSAM_SSH_TC_SMC = 0x1f,
327327
SSAM_SSH_TC_KPD = 0x20,
328-
SSAM_SSH_TC_REG = 0x21, // extended event registry
328+
SSAM_SSH_TC_REG = 0x21, /* Extended event registry. */
329329
};
330330

331331

module/src/clients/surface_acpi_notify.c

+27-27
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ enum sam_event_cid_tmp {
177177
struct san_event_work {
178178
struct delayed_work work;
179179
struct device *dev;
180-
struct ssam_event event; // must be last
180+
struct ssam_event event; /* must be last */
181181
};
182182

183183
static int san_acpi_notify_event(struct device *dev, u64 func,
@@ -410,39 +410,39 @@ struct gsb_data_in {
410410
} __packed;
411411

412412
struct gsb_data_rqsx {
413-
u8 cv; // command value (san_gsb_request_cv)
414-
u8 tc; // target category
415-
u8 tid; // target ID
416-
u8 iid; // instance ID
417-
u8 snc; // expect-response-flag?
418-
u8 cid; // command ID
419-
u16 cdl; // payload length
420-
u8 pld[]; // payload
413+
u8 cv; /* Command value (san_gsb_request_cv). */
414+
u8 tc; /* Target category. */
415+
u8 tid; /* Target ID. */
416+
u8 iid; /* Instance ID. */
417+
u8 snc; /* Expect-response-flag. */
418+
u8 cid; /* Command ID. */
419+
u16 cdl; /* Payload length. */
420+
u8 pld[]; /* Payload. */
421421
} __packed;
422422

423423
struct gsb_data_etwl {
424-
u8 cv; // command value (should be 0x02)
425-
u8 etw3; // unknown
426-
u8 etw4; // unknown
427-
u8 msg[]; // error message (ASCIIZ)
424+
u8 cv; /* Command value (should be 0x02). */
425+
u8 etw3; /* Unknown. */
426+
u8 etw4; /* Unknown. */
427+
u8 msg[]; /* Error message (ASCIIZ). */
428428
} __packed;
429429

430430
struct gsb_data_out {
431-
u8 status; // _SSH communication status
432-
u8 len; // _SSH payload length
433-
u8 pld[]; // _SSH payload
431+
u8 status; /* _SSH communication status. */
432+
u8 len; /* _SSH payload length. */
433+
u8 pld[]; /* _SSH payload. */
434434
} __packed;
435435

436436
union gsb_buffer_data {
437-
struct gsb_data_in in; // common input
438-
struct gsb_data_rqsx rqsx; // RQSX input
439-
struct gsb_data_etwl etwl; // ETWL input
440-
struct gsb_data_out out; // output
437+
struct gsb_data_in in; /* Common input. */
438+
struct gsb_data_rqsx rqsx; /* RQSX input. */
439+
struct gsb_data_etwl etwl; /* ETWL input. */
440+
struct gsb_data_out out; /* Output. */
441441
};
442442

443443
struct gsb_buffer {
444-
u8 status; // GSB AttribRawProcess status
445-
u8 len; // GSB AttribRawProcess length
444+
u8 status; /* GSB AttribRawProcess status. */
445+
u8 len; /* GSB AttribRawProcess length. */
446446
union gsb_buffer_data data;
447447
} __packed;
448448

@@ -472,7 +472,7 @@ static acpi_status san_etwl(struct san_data *d, struct gsb_buffer *b)
472472
(unsigned int)(b->len - sizeof(struct gsb_data_etwl)),
473473
(char *)etwl->msg);
474474

475-
// indicate success
475+
/* Indicate success. */
476476
b->status = 0x00;
477477
b->len = 0x00;
478478

@@ -579,7 +579,7 @@ static acpi_status san_rqst(struct san_data *d, struct gsb_buffer *buffer)
579579
rsp.length = 0;
580580
rsp.pointer = &rspbuf[0];
581581

582-
// handle suspended device
582+
/* Handle suspended device. */
583583
if (d->dev->power.is_suspended) {
584584
dev_warn(d->dev, "rqst: device is suspended, not executing\n");
585585
return san_rqst_fixup_suspended(d, &rqst, buffer);
@@ -644,7 +644,7 @@ static acpi_status san_opreg_handler(u32 function,
644644
return AE_OK;
645645
}
646646

647-
// buffer must have at least contain the command-value
647+
/* Buffer must have at least contain the command-value. */
648648
if (buffer->len == 0) {
649649
dev_err(d->dev, "request-package too small\n");
650650
return AE_OK;
@@ -766,13 +766,13 @@ static acpi_status san_consumer_setup(acpi_handle handle, u32 lvl,
766766
if (!is_san_consumer(pdev, handle))
767767
return AE_OK;
768768

769-
// ignore ACPI devices that are not present
769+
/* Ignore ACPI devices that are not present. */
770770
if (acpi_bus_get_device(handle, &adev) != 0)
771771
return AE_OK;
772772

773773
san_consumer_dbg(&pdev->dev, handle, "creating device link\n");
774774

775-
// try to set up device links, ignore but log errors
775+
/* Try to set up device links, ignore but log errors. */
776776
link = device_link_add(&adev->dev, &pdev->dev, flags);
777777
if (!link) {
778778
san_consumer_warn(&pdev->dev, handle,

module/src/clients/surface_aggregator_cdev.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)
8080
plddata = u64_to_user_ptr(rqst.payload.data);
8181
rspdata = u64_to_user_ptr(rqst.response.data);
8282

83-
// setup basic request fields
83+
/* Setup basic request fields. */
8484
spec.target_category = rqst.target_category;
8585
spec.target_id = rqst.target_id;
8686
spec.command_id = rqst.command_id;
@@ -93,7 +93,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)
9393
rsp.length = 0;
9494
rsp.pointer = NULL;
9595

96-
// get request payload from user-space
96+
/* Get request payload from user-space. */
9797
if (spec.length) {
9898
if (!plddata) {
9999
ret = -EINVAL;
@@ -113,7 +113,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)
113113
}
114114
}
115115

116-
// allocate response buffer
116+
/* Allocate response buffer. */
117117
if (rsp.capacity) {
118118
if (!rspdata) {
119119
ret = -EINVAL;
@@ -128,17 +128,17 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)
128128
}
129129
}
130130

131-
// perform request
131+
/* Perform request. */
132132
status = ssam_request_sync(cdev->ctrl, &spec, &rsp);
133133
if (status)
134134
goto out;
135135

136-
// copy response to user-space
136+
/* Copy response to user-space. */
137137
if (rsp.length && copy_to_user(rspdata, rsp.pointer, rsp.length))
138138
ret = -EFAULT;
139139

140140
out:
141-
// always try to set response-length and status
141+
/* Always try to set response-length and status. */
142142
tmp = put_user(rsp.length, &r->response.length);
143143
if (tmp)
144144
ret = tmp;
@@ -147,7 +147,7 @@ static long ssam_cdev_request(struct ssam_cdev *cdev, unsigned long arg)
147147
if (tmp)
148148
ret = tmp;
149149

150-
// cleanup
150+
/* Cleanup. */
151151
kfree(spec.payload);
152152
kfree(rsp.pointer);
153153

@@ -172,7 +172,7 @@ static long ssam_cdev_device_ioctl(struct file *file, unsigned int cmd,
172172
struct ssam_cdev *cdev = file->private_data;
173173
long status;
174174

175-
// ensure that controller is valid for as long as we need it
175+
/* Ensure that controller is valid for as long as we need it. */
176176
if (down_read_killable(&cdev->lock))
177177
return -ERESTARTSYS;
178178

module/src/clients/surface_aggregator_registry.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static int ssam_base_hub_probe(struct ssam_device *sdev)
450450
hub->sdev = sdev;
451451
hub->state = SSAM_BASE_HUB_UNINITIALIZED;
452452

453-
hub->notif.base.priority = 1000; // this notifier should run first
453+
hub->notif.base.priority = 1000; /* This notifier should run first. */
454454
hub->notif.base.fn = ssam_base_hub_notif;
455455
hub->notif.event.reg = SSAM_EVENT_REGISTRY_SAM;
456456
hub->notif.event.id.target_category = SSAM_SSH_TC_BAS,

module/src/clients/surface_battery.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static SSAM_DEFINE_SYNC_REQUEST_CL_W(ssam_bat_set_btp, __le32, {
119119
.command_id = 0x04,
120120
});
121121

122-
/* Get platform power soruce for battery (DPTF PSRC) */
122+
/* Get platform power source for battery (DPTF PSRC). */
123123
static SSAM_DEFINE_SYNC_REQUEST_CL_R(ssam_bat_get_psrc, __le32, {
124124
.target_category = SSAM_SSH_TC_BAT,
125125
.command_id = 0x0d,
@@ -259,7 +259,7 @@ static int spwr_battery_load_bix(struct spwr_battery_device *bat)
259259

260260
status = ssam_retry(ssam_bat_get_bix, bat->sdev, &bat->bix);
261261

262-
// enforce NULL terminated strings in case anything goes wrong...
262+
/* Enforce NULL terminated strings in case anything goes wrong... */
263263
bat->bix.model[ARRAY_SIZE(bat->bix.model) - 1] = 0;
264264
bat->bix.serial[ARRAY_SIZE(bat->bix.serial) - 1] = 0;
265265
bat->bix.type[ARRAY_SIZE(bat->bix.type) - 1] = 0;
@@ -413,7 +413,7 @@ static int spwr_battery_recheck_full(struct spwr_battery_device *bat)
413413
if (status)
414414
goto out;
415415

416-
// if battery has been attached, (re-)initialize alarm
416+
/* If battery has been attached, (re-)initialize alarm. */
417417
if (!present && spwr_battery_present(bat)) {
418418
u32 cap_warn = get_unaligned_le32(&bat->bix.design_cap_warn);
419419

@@ -496,7 +496,7 @@ static u32 spwr_notify_bat(struct ssam_event_notifier *nf,
496496
dev_dbg(&bat->sdev->dev, "power event (cid = 0x%02x, iid = %d, tid = %d)\n",
497497
event->command_id, event->instance_id, event->target_id);
498498

499-
// handled here, needs to be handled for all targets/instances
499+
/* Handled here, needs to be handled for all targets/instances. */
500500
if (event->command_id == SAM_EVENT_CID_BAT_ADP) {
501501
status = spwr_battery_recheck_adapter(bat);
502502
return ssam_notifier_from_errno(status) | SSAM_NOTIF_HANDLED;
@@ -700,7 +700,7 @@ static int spwr_battery_get_property(struct power_supply *psy,
700700
if (status)
701701
goto out;
702702

703-
// abort if battery is not present
703+
/* Abort if battery is not present. */
704704
if (!spwr_battery_present(bat) && psp != POWER_SUPPLY_PROP_PRESENT) {
705705
status = -ENODEV;
706706
goto out;
@@ -884,7 +884,7 @@ static int spwr_ac_register(struct spwr_ac_device *ac)
884884
__le32 sta;
885885
int status;
886886

887-
// make sure the device is there and functioning properly
887+
/* Make sure the device is there and functioning properly. */
888888
status = ssam_retry(ssam_bat_get_sta, ac->sdev, &sta);
889889
if (status)
890890
return status;
@@ -947,7 +947,7 @@ static int spwr_battery_register(struct spwr_battery_device *bat)
947947
__le32 sta;
948948
int status;
949949

950-
// make sure the device is there and functioning properly
950+
/* Make sure the device is there and functioning properly. */
951951
status = ssam_retry(ssam_bat_get_sta, bat->sdev, &sta);
952952
if (status)
953953
return status;

0 commit comments

Comments
 (0)