aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2016-04-21 03:04:50 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-04-25 18:27:14 -0400
commitec7c34a4c6c71487a5de4c1b2d47beb2c334aa0d (patch)
tree3dc2fa4a41eba9afa13fa03c9c7f794c1fdca345
parentb1b3df2fc808187e3c9e50162b55fb458035b0ab (diff)
i2c: s3c2410: Minor function-level comment cleanup
Cleanup the weird function-level comments and remove obvious documentation for probe/remove. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c110
1 files changed, 32 insertions, 78 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 3f16f30edbd2..7245c81366be 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -163,11 +163,9 @@ static const struct of_device_id s3c24xx_i2c_match[] = {
163MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match); 163MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match);
164#endif 164#endif
165 165
166/* s3c24xx_get_device_quirks 166/*
167 *
168 * Get controller type either from device tree or platform device variant. 167 * Get controller type either from device tree or platform device variant.
169*/ 168 */
170
171static inline kernel_ulong_t s3c24xx_get_device_quirks(struct platform_device *pdev) 169static inline kernel_ulong_t s3c24xx_get_device_quirks(struct platform_device *pdev)
172{ 170{
173 if (pdev->dev.of_node) { 171 if (pdev->dev.of_node) {
@@ -179,12 +177,10 @@ static inline kernel_ulong_t s3c24xx_get_device_quirks(struct platform_device *p
179 return platform_get_device_id(pdev)->driver_data; 177 return platform_get_device_id(pdev)->driver_data;
180} 178}
181 179
182/* s3c24xx_i2c_master_complete 180/*
183 * 181 * Complete the message and wake up the caller, using the given return code,
184 * complete the message and wake up the caller, using the given return code,
185 * or zero to mean ok. 182 * or zero to mean ok.
186*/ 183 */
187
188static inline void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret) 184static inline void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret)
189{ 185{
190 dev_dbg(i2c->dev, "master_complete %d\n", ret); 186 dev_dbg(i2c->dev, "master_complete %d\n", ret);
@@ -217,7 +213,6 @@ static inline void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c)
217} 213}
218 214
219/* irq enable/disable functions */ 215/* irq enable/disable functions */
220
221static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c) 216static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c)
222{ 217{
223 unsigned long tmp; 218 unsigned long tmp;
@@ -251,11 +246,9 @@ static bool is_ack(struct s3c24xx_i2c *i2c)
251 return false; 246 return false;
252} 247}
253 248
254/* s3c24xx_i2c_message_start 249/*
255 *
256 * put the start of a message onto the bus 250 * put the start of a message onto the bus
257*/ 251 */
258
259static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c, 252static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
260 struct i2c_msg *msg) 253 struct i2c_msg *msg)
261{ 254{
@@ -364,21 +357,17 @@ static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
364/* helper functions to determine the current state in the set of 357/* helper functions to determine the current state in the set of
365 * messages we are sending */ 358 * messages we are sending */
366 359
367/* is_lastmsg() 360/*
368 *
369 * returns TRUE if the current message is the last in the set 361 * returns TRUE if the current message is the last in the set
370*/ 362 */
371
372static inline int is_lastmsg(struct s3c24xx_i2c *i2c) 363static inline int is_lastmsg(struct s3c24xx_i2c *i2c)
373{ 364{
374 return i2c->msg_idx >= (i2c->msg_num - 1); 365 return i2c->msg_idx >= (i2c->msg_num - 1);
375} 366}
376 367
377/* is_msglast 368/*
378 *
379 * returns TRUE if we this is the last byte in the current message 369 * returns TRUE if we this is the last byte in the current message
380*/ 370 */
381
382static inline int is_msglast(struct s3c24xx_i2c *i2c) 371static inline int is_msglast(struct s3c24xx_i2c *i2c)
383{ 372{
384 /* msg->len is always 1 for the first byte of smbus block read. 373 /* msg->len is always 1 for the first byte of smbus block read.
@@ -390,21 +379,17 @@ static inline int is_msglast(struct s3c24xx_i2c *i2c)
390 return i2c->msg_ptr == i2c->msg->len-1; 379 return i2c->msg_ptr == i2c->msg->len-1;
391} 380}
392 381
393/* is_msgend 382/*
394 *
395 * returns TRUE if we reached the end of the current message 383 * returns TRUE if we reached the end of the current message
396*/ 384 */
397
398static inline int is_msgend(struct s3c24xx_i2c *i2c) 385static inline int is_msgend(struct s3c24xx_i2c *i2c)
399{ 386{
400 return i2c->msg_ptr >= i2c->msg->len; 387 return i2c->msg_ptr >= i2c->msg->len;
401} 388}
402 389
403/* i2c_s3c_irq_nextbyte 390/*
404 *
405 * process an interrupt and work out what to do 391 * process an interrupt and work out what to do
406 */ 392 */
407
408static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) 393static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
409{ 394{
410 unsigned long tmp; 395 unsigned long tmp;
@@ -568,11 +553,9 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
568 return ret; 553 return ret;
569} 554}
570 555
571/* s3c24xx_i2c_irq 556/*
572 *
573 * top level IRQ servicing routine 557 * top level IRQ servicing routine
574*/ 558 */
575
576static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id) 559static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
577{ 560{
578 struct s3c24xx_i2c *i2c = dev_id; 561 struct s3c24xx_i2c *i2c = dev_id;
@@ -630,11 +613,9 @@ static inline void s3c24xx_i2c_disable_bus(struct s3c24xx_i2c *i2c)
630} 613}
631 614
632 615
633/* s3c24xx_i2c_set_master 616/*
634 *
635 * get the i2c bus for a master transaction 617 * get the i2c bus for a master transaction
636*/ 618 */
637
638static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c) 619static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
639{ 620{
640 unsigned long iicstat; 621 unsigned long iicstat;
@@ -652,11 +633,9 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
652 return -ETIMEDOUT; 633 return -ETIMEDOUT;
653} 634}
654 635
655/* s3c24xx_i2c_wait_idle 636/*
656 *
657 * wait for the i2c bus to become idle. 637 * wait for the i2c bus to become idle.
658*/ 638 */
659
660static void s3c24xx_i2c_wait_idle(struct s3c24xx_i2c *i2c) 639static void s3c24xx_i2c_wait_idle(struct s3c24xx_i2c *i2c)
661{ 640{
662 unsigned long iicstat; 641 unsigned long iicstat;
@@ -706,11 +685,9 @@ static void s3c24xx_i2c_wait_idle(struct s3c24xx_i2c *i2c)
706 dev_warn(i2c->dev, "timeout waiting for bus idle\n"); 685 dev_warn(i2c->dev, "timeout waiting for bus idle\n");
707} 686}
708 687
709/* s3c24xx_i2c_doxfer 688/*
710 *
711 * this starts an i2c transfer 689 * this starts an i2c transfer
712*/ 690 */
713
714static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, 691static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
715 struct i2c_msg *msgs, int num) 692 struct i2c_msg *msgs, int num)
716{ 693{
@@ -771,12 +748,10 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
771 return ret; 748 return ret;
772} 749}
773 750
774/* s3c24xx_i2c_xfer 751/*
775 *
776 * first port of call from the i2c bus code when an message needs 752 * first port of call from the i2c bus code when an message needs
777 * transferring across the i2c bus. 753 * transferring across the i2c bus.
778*/ 754 */
779
780static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, 755static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
781 struct i2c_msg *msgs, int num) 756 struct i2c_msg *msgs, int num)
782{ 757{
@@ -814,17 +789,14 @@ static u32 s3c24xx_i2c_func(struct i2c_adapter *adap)
814} 789}
815 790
816/* i2c bus registration info */ 791/* i2c bus registration info */
817
818static const struct i2c_algorithm s3c24xx_i2c_algorithm = { 792static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
819 .master_xfer = s3c24xx_i2c_xfer, 793 .master_xfer = s3c24xx_i2c_xfer,
820 .functionality = s3c24xx_i2c_func, 794 .functionality = s3c24xx_i2c_func,
821}; 795};
822 796
823/* s3c24xx_i2c_calcdivisor 797/*
824 *
825 * return the divisor settings for a given frequency 798 * return the divisor settings for a given frequency
826*/ 799 */
827
828static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted, 800static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted,
829 unsigned int *div1, unsigned int *divs) 801 unsigned int *div1, unsigned int *divs)
830{ 802{
@@ -850,13 +822,11 @@ static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted,
850 return clkin / (calc_divs * calc_div1); 822 return clkin / (calc_divs * calc_div1);
851} 823}
852 824
853/* s3c24xx_i2c_clockrate 825/*
854 *
855 * work out a divisor for the user requested frequency setting, 826 * work out a divisor for the user requested frequency setting,
856 * either by the requested frequency, or scanning the acceptable 827 * either by the requested frequency, or scanning the acceptable
857 * range of frequencies until something is found 828 * range of frequencies until something is found
858*/ 829 */
859
860static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) 830static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
861{ 831{
862 struct s3c2410_platform_i2c *pdata = i2c->pdata; 832 struct s3c2410_platform_i2c *pdata = i2c->pdata;
@@ -1028,11 +998,9 @@ static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c)
1028} 998}
1029#endif 999#endif
1030 1000
1031/* s3c24xx_i2c_init 1001/*
1032 *
1033 * initialise the controller, set the IO lines and frequency 1002 * initialise the controller, set the IO lines and frequency
1034*/ 1003 */
1035
1036static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c) 1004static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
1037{ 1005{
1038 struct s3c2410_platform_i2c *pdata; 1006 struct s3c2410_platform_i2c *pdata;
@@ -1068,11 +1036,9 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
1068} 1036}
1069 1037
1070#ifdef CONFIG_OF 1038#ifdef CONFIG_OF
1071/* s3c24xx_i2c_parse_dt 1039/*
1072 *
1073 * Parse the device tree node and retreive the platform data. 1040 * Parse the device tree node and retreive the platform data.
1074*/ 1041 */
1075
1076static void 1042static void
1077s3c24xx_i2c_parse_dt(struct device_node *np, struct s3c24xx_i2c *i2c) 1043s3c24xx_i2c_parse_dt(struct device_node *np, struct s3c24xx_i2c *i2c)
1078{ 1044{
@@ -1111,11 +1077,6 @@ s3c24xx_i2c_parse_dt(struct device_node *np, struct s3c24xx_i2c *i2c)
1111} 1077}
1112#endif 1078#endif
1113 1079
1114/* s3c24xx_i2c_probe
1115 *
1116 * called by the bus driver when a suitable device is found
1117*/
1118
1119static int s3c24xx_i2c_probe(struct platform_device *pdev) 1080static int s3c24xx_i2c_probe(struct platform_device *pdev)
1120{ 1081{
1121 struct s3c24xx_i2c *i2c; 1082 struct s3c24xx_i2c *i2c;
@@ -1258,11 +1219,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1258 return 0; 1219 return 0;
1259} 1220}
1260 1221
1261/* s3c24xx_i2c_remove
1262 *
1263 * called when device is removed from the bus
1264*/
1265
1266static int s3c24xx_i2c_remove(struct platform_device *pdev) 1222static int s3c24xx_i2c_remove(struct platform_device *pdev)
1267{ 1223{
1268 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); 1224 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
@@ -1326,8 +1282,6 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
1326#define S3C24XX_DEV_PM_OPS NULL 1282#define S3C24XX_DEV_PM_OPS NULL
1327#endif 1283#endif
1328 1284
1329/* device driver for platform bus bits */
1330
1331static struct platform_driver s3c24xx_i2c_driver = { 1285static struct platform_driver s3c24xx_i2c_driver = {
1332 .probe = s3c24xx_i2c_probe, 1286 .probe = s3c24xx_i2c_probe,
1333 .remove = s3c24xx_i2c_remove, 1287 .remove = s3c24xx_i2c_remove,