Skip to content

Commit bccbe21

Browse files
EvenxfJiri Kosina
authored andcommitted
HID: Intel-thc-hid: Intel-quicki2c: Refine code comments
Align capitalization of the first characters for all code comments and refine some descriptions. Signed-off-by: Even Xu <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 22da60f commit bccbe21

File tree

2 files changed

+69
-81
lines changed

2 files changed

+69
-81
lines changed

drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c

Lines changed: 57 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ static guid_t thc_platform_guid =
2929

3030
/**
3131
* quicki2c_acpi_get_dsm_property - Query device ACPI DSM parameter
32-
*
33-
* @adev: point to ACPI device
32+
* @adev: Point to ACPI device
3433
* @guid: ACPI method's guid
3534
* @rev: ACPI method's revision
3635
* @func: ACPI method's function number
3736
* @type: ACPI parameter's data type
38-
* @prop_buf: point to return buffer
37+
* @prop_buf: Point to return buffer
3938
*
4039
* This is a helper function for device to query its ACPI DSM parameters.
4140
*
42-
* Return: 0 if success or ENODEV on failed.
41+
* Return: 0 if success or ENODEV on failure.
4342
*/
4443
static int quicki2c_acpi_get_dsm_property(struct acpi_device *adev, const guid_t *guid,
4544
u64 rev, u64 func, acpi_object_type type, void *prop_buf)
@@ -67,11 +66,10 @@ static int quicki2c_acpi_get_dsm_property(struct acpi_device *adev, const guid_t
6766

6867
/**
6968
* quicki2c_acpi_get_dsd_property - Query device ACPI DSD parameter
70-
*
71-
* @adev: point to ACPI device
69+
* @adev: Point to ACPI device
7270
* @dsd_method_name: ACPI method's property name
7371
* @type: ACPI parameter's data type
74-
* @prop_buf: point to return buffer
72+
* @prop_buf: Point to return buffer
7573
*
7674
* This is a helper function for device to query its ACPI DSD parameters.
7775
*
@@ -100,13 +98,12 @@ static int quicki2c_acpi_get_dsd_property(struct acpi_device *adev, acpi_string
10098
}
10199

102100
/**
103-
* quicki2c_get_acpi_resources - Query all quicki2c devices' ACPI parameters
104-
*
105-
* @qcdev: point to quicki2c device
101+
* quicki2c_get_acpi_resources - Query all QuickI2C devices' ACPI parameters
102+
* @qcdev: Point to quicki2c_device structure
106103
*
107-
* This function gets all quicki2c devices' ACPI resource.
104+
* This function gets all QuickI2C devices' ACPI resource.
108105
*
109-
* Return: 0 if success or error code on failed.
106+
* Return: 0 if success or error code on failure.
110107
*/
111108
static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
112109
{
@@ -192,10 +189,9 @@ static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
192189
}
193190

194191
/**
195-
* quicki2c_irq_quick_handler - The ISR of the quicki2c driver
196-
*
192+
* quicki2c_irq_quick_handler - The ISR of the QuickI2C driver
197193
* @irq: The irq number
198-
* @dev_id: pointer to the device structure
194+
* @dev_id: Pointer to the quicki2c_device structure
199195
*
200196
* Return: IRQ_WAKE_THREAD if further process needed.
201197
*/
@@ -214,13 +210,13 @@ static irqreturn_t quicki2c_irq_quick_handler(int irq, void *dev_id)
214210

215211
/**
216212
* try_recover - Try to recovery THC and Device
217-
* @qcdev: pointer to quicki2c device
213+
* @qcdev: Pointer to quicki2c_device structure
218214
*
219-
* This function is a error handler, called when fatal error happens.
220-
* It try to reset Touch Device and re-configure THC to recovery
221-
* transferring between Device and THC.
215+
* This function is an error handler, called when fatal error happens.
216+
* It try to reset touch device and re-configure THC to recovery
217+
* communication between touch device and THC.
222218
*
223-
* Return: 0 if successful or error code on failed
219+
* Return: 0 if successful or error code on failure
224220
*/
225221
static int try_recover(struct quicki2c_device *qcdev)
226222
{
@@ -264,7 +260,7 @@ static int handle_input_report(struct quicki2c_device *qcdev)
264260
continue;
265261
}
266262

267-
/* discard samples before driver probe complete */
263+
/* Discard samples before driver probe complete */
268264
if (qcdev->state != QUICKI2C_ENABLED)
269265
continue;
270266

@@ -276,10 +272,9 @@ static int handle_input_report(struct quicki2c_device *qcdev)
276272
}
277273

278274
/**
279-
* quicki2c_irq_thread_handler - IRQ thread handler of quicki2c driver
280-
*
275+
* quicki2c_irq_thread_handler - IRQ thread handler of QuickI2C driver
281276
* @irq: The IRQ number
282-
* @dev_id: pointer to the quicki2c device structure
277+
* @dev_id: Pointer to the quicki2c_device structure
283278
*
284279
* Return: IRQ_HANDLED to finish this handler.
285280
*/
@@ -325,18 +320,17 @@ static irqreturn_t quicki2c_irq_thread_handler(int irq, void *dev_id)
325320
}
326321

327322
/**
328-
* quicki2c_dev_init - Initialize quicki2c device
329-
*
330-
* @pdev: pointer to the thc pci device
331-
* @mem_addr: The pointer of MMIO memory address
323+
* quicki2c_dev_init - Initialize QuickI2C device
324+
* @pdev: Pointer to the THC PCI device
325+
* @mem_addr: The Pointer of MMIO memory address
332326
*
333-
* Alloc quicki2c device structure and initialized THC device,
327+
* Alloc quicki2c_device structure and initialized THC device,
334328
* then configure THC to HIDI2C mode.
335329
*
336330
* If success, enable THC hardware interrupt.
337331
*
338-
* Return: pointer to the quicki2c device structure if success
339-
* or NULL on failed.
332+
* Return: Pointer to the quicki2c_device structure if success
333+
* or NULL on failure.
340334
*/
341335
static struct quicki2c_device *quicki2c_dev_init(struct pci_dev *pdev, void __iomem *mem_addr)
342336
{
@@ -355,7 +349,7 @@ static struct quicki2c_device *quicki2c_dev_init(struct pci_dev *pdev, void __io
355349

356350
init_waitqueue_head(&qcdev->reset_ack_wq);
357351

358-
/* thc hw init */
352+
/* THC hardware init */
359353
qcdev->thc_hw = thc_dev_init(qcdev->dev, qcdev->mem_addr);
360354
if (IS_ERR(qcdev->thc_hw)) {
361355
ret = PTR_ERR(qcdev->thc_hw);
@@ -398,9 +392,8 @@ static struct quicki2c_device *quicki2c_dev_init(struct pci_dev *pdev, void __io
398392
}
399393

400394
/**
401-
* quicki2c_dev_deinit - De-initialize quicki2c device
402-
*
403-
* @qcdev: pointer to the quicki2c device structure
395+
* quicki2c_dev_deinit - De-initialize QuickI2C device
396+
* @qcdev: Pointer to the quicki2c_device structure
404397
*
405398
* Disable THC interrupt and deinitilize THC.
406399
*/
@@ -413,13 +406,13 @@ static void quicki2c_dev_deinit(struct quicki2c_device *qcdev)
413406
}
414407

415408
/**
416-
* quicki2c_dma_init - Configure THC DMA for quicki2c device
417-
* @qcdev: pointer to the quicki2c device structure
409+
* quicki2c_dma_init - Configure THC DMA for QuickI2C device
410+
* @qcdev: Pointer to the quicki2c_device structure
418411
*
419412
* This function uses TIC's parameters(such as max input length, max output
420413
* length) to allocate THC DMA buffers and configure THC DMA engines.
421414
*
422-
* Return: 0 if success or error code on failed.
415+
* Return: 0 if success or error code on failure.
423416
*/
424417
static int quicki2c_dma_init(struct quicki2c_device *qcdev)
425418
{
@@ -451,12 +444,12 @@ static int quicki2c_dma_init(struct quicki2c_device *qcdev)
451444
return ret;
452445
}
453446

454-
return ret;
447+
return 0;
455448
}
456449

457450
/**
458-
* quicki2c_dma_deinit - Release THC DMA for quicki2c device
459-
* @qcdev: pointer to the quicki2c device structure
451+
* quicki2c_dma_deinit - Release THC DMA for QuickI2C device
452+
* @qcdev: Pointer to the quicki2c_device structure
460453
*
461454
* Stop THC DMA engines and release all DMA buffers.
462455
*
@@ -469,7 +462,7 @@ static void quicki2c_dma_deinit(struct quicki2c_device *qcdev)
469462

470463
/**
471464
* quicki2c_alloc_report_buf - Alloc report buffers
472-
* @qcdev: pointer to the quicki2c device structure
465+
* @qcdev: Pointer to the quicki2c_device structure
473466
*
474467
* Allocate report descriptor buffer, it will be used for restore TIC HID
475468
* report descriptor.
@@ -480,7 +473,7 @@ static void quicki2c_dma_deinit(struct quicki2c_device *qcdev)
480473
* Allocate output report buffer, it will be used for store HID output report,
481474
* such as set feature.
482475
*
483-
* Return: 0 if success or error code on failed.
476+
* Return: 0 if success or error code on failure.
484477
*/
485478
static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev)
486479
{
@@ -518,24 +511,23 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev)
518511
}
519512

520513
/*
521-
* quicki2c_probe: Quicki2c driver probe function
522-
*
523-
* @pdev: point to pci device
524-
* @id: point to pci_device_id structure
514+
* quicki2c_probe: QuickI2C driver probe function
515+
* @pdev: Point to PCI device
516+
* @id: Point to pci_device_id structure
525517
*
526518
* This function initializes THC and HIDI2C device, the flow is:
527-
* - do THC pci device initialization
528-
* - query HIDI2C ACPI parameters
529-
* - configure THC to HIDI2C mode
530-
* - go through HIDI2C enumeration flow
531-
* |- read device descriptor
532-
* |- reset HIDI2C device
533-
* - enable THC interrupt and DMA
534-
* - read report descriptor
535-
* - register HID device
536-
* - enable runtime power management
537-
*
538-
* Return 0 if success or error code on failed.
519+
* - Do THC pci device initialization
520+
* - Query HIDI2C ACPI parameters
521+
* - Configure THC to HIDI2C mode
522+
* - Go through HIDI2C enumeration flow
523+
* |- Read device descriptor
524+
* |- Reset HIDI2C device
525+
* - Enable THC interrupt and DMA
526+
* - Read report descriptor
527+
* - Register HID device
528+
* - Enable runtime power management
529+
*
530+
* Return 0 if success or error code on failure.
539531
*/
540532
static int quicki2c_probe(struct pci_dev *pdev,
541533
const struct pci_device_id *id)
@@ -668,11 +660,10 @@ static int quicki2c_probe(struct pci_dev *pdev,
668660

669661
/**
670662
* quicki2c_remove - Device Removal Routine
663+
* @pdev: Point to PCI device structure
671664
*
672-
* @pdev: PCI device structure
673-
*
674-
* This is called by the PCI subsystem to alert the driver
675-
* that it should release a PCI device.
665+
* This is called by the PCI subsystem to alert the driver that it should
666+
* release a PCI device.
676667
*/
677668
static void quicki2c_remove(struct pci_dev *pdev)
678669
{
@@ -694,12 +685,10 @@ static void quicki2c_remove(struct pci_dev *pdev)
694685

695686
/**
696687
* quicki2c_shutdown - Device Shutdown Routine
688+
* @pdev: Point to PCI device structure
697689
*
698-
* @pdev: PCI device structure
699-
*
700-
* This is called from the reboot notifier
701-
* it's a simplified version of remove so we go down
702-
* faster.
690+
* This is called from the reboot notifier, it's a simplified version of remove
691+
* so we go down faster.
703692
*/
704693
static void quicki2c_shutdown(struct pci_dev *pdev)
705694
{

drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,27 @@ struct acpi_device;
130130

131131
/**
132132
* struct quicki2c_device - THC QuickI2C device struct
133-
* @dev: point to kernel device
134-
* @pdev: point to PCI device
135-
* @thc_hw: point to THC device
136-
* @hid_dev: point to hid device
137-
* @acpi_dev: point to ACPI device
138-
* @driver_data: point to quicki2c specific driver data
133+
* @dev: Point to kernel device
134+
* @pdev: Point to PCI device
135+
* @thc_hw: Point to THC device
136+
* @hid_dev: Point to HID device
137+
* @acpi_dev: Point to ACPI device
139138
* @state: THC I2C device state
140139
* @mem_addr: MMIO memory address
141-
* @dev_desc: device descriptor for HIDI2C protocol
140+
* @dev_desc: Device descriptor for HIDI2C protocol
142141
* @i2c_slave_addr: HIDI2C device slave address
143142
* @hid_desc_addr: Register address for retrieve HID device descriptor
144143
* @active_ltr_val: THC active LTR value
145144
* @low_power_ltr_val: THC low power LTR value
146145
* @i2c_speed_mode: 0 - standard mode, 1 - fast mode, 2 - fast mode plus
147146
* @i2c_clock_hcnt: I2C CLK high period time (unit in cycle count)
148147
* @i2c_clock_lcnt: I2C CLK low period time (unit in cycle count)
149-
* @report_descriptor: store a copy of device report descriptor
150-
* @input_buf: store a copy of latest input report data
151-
* @report_buf: store a copy of latest input/output report packet from set/get feature
152-
* @report_len: the length of input/output report packet
153-
* @reset_ack_wq: workqueue for waiting reset response from device
154-
* @reset_ack: indicate reset response received or not
148+
* @report_descriptor: Store a copy of device report descriptor
149+
* @input_buf: Store a copy of latest input report data
150+
* @report_buf: Store a copy of latest input/output report packet from set/get feature
151+
* @report_len: The length of input/output report packet
152+
* @reset_ack_wq: Workqueue for waiting reset response from device
153+
* @reset_ack: Indicate reset response received or not
155154
*/
156155
struct quicki2c_device {
157156
struct device *dev;

0 commit comments

Comments
 (0)