aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-05-01 17:26:31 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-01 17:26:31 -0400
commit0f3b48385213355a2d4408bec1b481ffcf0e8638 (patch)
tree7684461552fd477e94cb36d90983e7cc0c35356f
parentc05646069ccf8e94031ca9c8ab18fff35ba4405e (diff)
i2c-algo-bit: Add i2c_bit_add_numbered_bus
Add i2c_bit_add_numbered_bus(), which is equivalent to i2c_bit_add_bus except that it calls i2c_add_numbered_adapter() at the end instead of i2c_add_adapter(). Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c25
-rw-r--r--include/linux/i2c-algo-bit.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index fcef6ff3d287..fc16f9d268a3 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -540,7 +540,7 @@ static const struct i2c_algorithm i2c_bit_algo = {
540/* 540/*
541 * registering functions to load algorithms at runtime 541 * registering functions to load algorithms at runtime
542 */ 542 */
543int i2c_bit_add_bus(struct i2c_adapter *adap) 543static int i2c_bit_prepare_bus(struct i2c_adapter *adap)
544{ 544{
545 struct i2c_algo_bit_data *bit_adap = adap->algo_data; 545 struct i2c_algo_bit_data *bit_adap = adap->algo_data;
546 546
@@ -558,10 +558,33 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
558 adap->timeout = 100; /* default values, should */ 558 adap->timeout = 100; /* default values, should */
559 adap->retries = 3; /* be replaced by defines */ 559 adap->retries = 3; /* be replaced by defines */
560 560
561 return 0;
562}
563
564int i2c_bit_add_bus(struct i2c_adapter *adap)
565{
566 int err;
567
568 err = i2c_bit_prepare_bus(adap);
569 if (err)
570 return err;
571
561 return i2c_add_adapter(adap); 572 return i2c_add_adapter(adap);
562} 573}
563EXPORT_SYMBOL(i2c_bit_add_bus); 574EXPORT_SYMBOL(i2c_bit_add_bus);
564 575
576int i2c_bit_add_numbered_bus(struct i2c_adapter *adap)
577{
578 int err;
579
580 err = i2c_bit_prepare_bus(adap);
581 if (err)
582 return err;
583
584 return i2c_add_numbered_adapter(adap);
585}
586EXPORT_SYMBOL(i2c_bit_add_numbered_bus);
587
565MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 588MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
566MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); 589MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm");
567MODULE_LICENSE("GPL"); 590MODULE_LICENSE("GPL");
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 937da70cb4c4..d91dab886357 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -44,5 +44,6 @@ struct i2c_algo_bit_data {
44}; 44};
45 45
46int i2c_bit_add_bus(struct i2c_adapter *); 46int i2c_bit_add_bus(struct i2c_adapter *);
47int i2c_bit_add_numbered_bus(struct i2c_adapter *);
47 48
48#endif /* _LINUX_I2C_ALGO_BIT_H */ 49#endif /* _LINUX_I2C_ALGO_BIT_H */