* [2.6 patch] i2c-core.c: make some code static
@ 2005-01-31 18:59 Adrian Bunk
2005-01-31 20:50 ` Jean Delvare
2005-02-01 8:18 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Adrian Bunk @ 2005-01-31 18:59 UTC (permalink / raw)
To: greg, phil; +Cc: sensors, linux-kernel
This patch makes some needlessly global code static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
---
drivers/i2c/i2c-core.c | 79 ++++++++++++++++++++---------------------
include/linux/i2c.h | 2 -
2 files changed, 39 insertions(+), 42 deletions(-)
--- linux-2.6.11-rc2-mm2-full/include/linux/i2c.h.old 2005-01-31 19:16:45.000000000 +0100
+++ linux-2.6.11-rc2-mm2-full/include/linux/i2c.h 2005-01-31 19:16:52.000000000 +0100
@@ -134,8 +134,6 @@
};
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
-extern struct bus_type i2c_bus_type;
-
#define I2C_NAME_SIZE 50
/*
--- linux-2.6.11-rc2-mm2-full/drivers/i2c/i2c-core.c.old 2005-01-31 19:17:00.000000000 +0100
+++ linux-2.6.11-rc2-mm2-full/drivers/i2c/i2c-core.c 2005-01-31 19:20:45.000000000 +0100
@@ -38,12 +38,43 @@
static DECLARE_MUTEX(core_lists);
static DEFINE_IDR(i2c_adapter_idr);
-int i2c_device_probe(struct device *dev)
+/* match always succeeds, as we want the probe() to tell if we really accept this match */
+static int i2c_device_match(struct device *dev, struct device_driver *drv)
+{
+ return 1;
+}
+
+static int i2c_bus_suspend(struct device * dev, pm_message_t state)
+{
+ int rc = 0;
+
+ if (dev->driver && dev->driver->suspend)
+ rc = dev->driver->suspend(dev,state,0);
+ return rc;
+}
+
+static int i2c_bus_resume(struct device * dev)
+{
+ int rc = 0;
+
+ if (dev->driver && dev->driver->resume)
+ rc = dev->driver->resume(dev,0);
+ return rc;
+}
+
+static struct bus_type i2c_bus_type = {
+ .name = "i2c",
+ .match = i2c_device_match,
+ .suspend = i2c_bus_suspend,
+ .resume = i2c_bus_resume,
+};
+
+static int i2c_device_probe(struct device *dev)
{
return -ENODEV;
}
-int i2c_device_remove(struct device *dev)
+static int i2c_device_remove(struct device *dev)
{
return 0;
}
@@ -523,38 +554,6 @@
up(&adap->clist_lock);
}
-
-/* match always succeeds, as we want the probe() to tell if we really accept this match */
-static int i2c_device_match(struct device *dev, struct device_driver *drv)
-{
- return 1;
-}
-
-static int i2c_bus_suspend(struct device * dev, pm_message_t state)
-{
- int rc = 0;
-
- if (dev->driver && dev->driver->suspend)
- rc = dev->driver->suspend(dev,state,0);
- return rc;
-}
-
-static int i2c_bus_resume(struct device * dev)
-{
- int rc = 0;
-
- if (dev->driver && dev->driver->resume)
- rc = dev->driver->resume(dev,0);
- return rc;
-}
-
-struct bus_type i2c_bus_type = {
- .name = "i2c",
- .match = i2c_device_match,
- .suspend = i2c_bus_suspend,
- .resume = i2c_bus_resume,
-};
-
static int __init i2c_init(void)
{
int retval;
@@ -860,7 +859,7 @@
/* CRC over count bytes in the first array plus the bytes in the rest
array if it is non-null. rest[0] is the (length of rest) - 1
and is included. */
-u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest)
+static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest)
{
int i;
@@ -872,7 +871,7 @@
return crc;
}
-u8 i2c_smbus_pec(int count, u8 *first, u8 *rest)
+static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest)
{
return i2c_smbus_partial_pec(0, count, first, rest);
}
@@ -880,8 +879,8 @@
/* Returns new "size" (transaction type)
Note that we convert byte to byte_data and byte_data to word_data
rather than invent new xxx_PEC transactions. */
-int i2c_smbus_add_pec(u16 addr, u8 command, int size,
- union i2c_smbus_data *data)
+static int i2c_smbus_add_pec(u16 addr, u8 command, int size,
+ union i2c_smbus_data *data)
{
u8 buf[3];
@@ -910,8 +909,8 @@
return size;
}
-int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial,
- union i2c_smbus_data *data)
+static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial,
+ union i2c_smbus_data *data)
{
u8 buf[3], rpec, cpec;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] i2c-core.c: make some code static
2005-01-31 18:59 [2.6 patch] i2c-core.c: make some code static Adrian Bunk
@ 2005-01-31 20:50 ` Jean Delvare
2005-01-31 21:46 ` Adrian Bunk
2005-02-01 8:18 ` Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2005-01-31 20:50 UTC (permalink / raw)
To: Adrian Bunk; +Cc: greg, sensors, linux-kernel
Hi Adrian,
> This patch makes some needlessly global code static.
> (...)
> @@ -38,12 +38,43 @@
> static DECLARE_MUTEX(core_lists);
> static DEFINE_IDR(i2c_adapter_idr);
>
> -int i2c_device_probe(struct device *dev)
> +/* match always succeeds, as we want the probe() to tell if we really
> accept this match */ +static int i2c_device_match(struct device *dev,
> struct device_driver *drv) +{
> + return 1;
> +}
> +
> +static int i2c_bus_suspend(struct device * dev, pm_message_t state)
> +{
> + int rc = 0;
> +
> + if (dev->driver && dev->driver->suspend)
> + rc = dev->driver->suspend(dev,state,0);
> + return rc;
> +}
> +
> +static int i2c_bus_resume(struct device * dev)
> +{
> + int rc = 0;
> +
> + if (dev->driver && dev->driver->resume)
> + rc = dev->driver->resume(dev,0);
> + return rc;
> +}
> +
> +static struct bus_type i2c_bus_type = {
> + .name = "i2c",
> + .match = i2c_device_match,
> + .suspend = i2c_bus_suspend,
> + .resume = i2c_bus_resume,
> +};
> +
> +static int i2c_device_probe(struct device *dev)
> {
> return -ENODEV;
> }
>
> -int i2c_device_remove(struct device *dev)
> +static int i2c_device_remove(struct device *dev)
> {
> return 0;
> }
> @@ -523,38 +554,6 @@
> up(&adap->clist_lock);
> }
>
> -
> -/* match always succeeds, as we want the probe() to tell if we really
> accept this match */ -static int i2c_device_match(struct device *dev,
> struct device_driver *drv) -{
> - return 1;
> -}
> -
> -static int i2c_bus_suspend(struct device * dev, pm_message_t state)
> -{
> - int rc = 0;
> -
> - if (dev->driver && dev->driver->suspend)
> - rc = dev->driver->suspend(dev,state,0);
> - return rc;
> -}
> -
> -static int i2c_bus_resume(struct device * dev)
> -{
> - int rc = 0;
> -
> - if (dev->driver && dev->driver->resume)
> - rc = dev->driver->resume(dev,0);
> - return rc;
> -}
> -
> -struct bus_type i2c_bus_type = {
> - .name = "i2c",
> - .match = i2c_device_match,
> - .suspend = i2c_bus_suspend,
> - .resume = i2c_bus_resume,
> -};
> -
> static int __init i2c_init(void)
> {
> int retval;
Is moving that code around really necessary? Looks to me like only the
i2c_bus_type structure needs to be moved.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] i2c-core.c: make some code static
2005-01-31 20:50 ` Jean Delvare
@ 2005-01-31 21:46 ` Adrian Bunk
2005-01-31 22:04 ` Jean Delvare
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2005-01-31 21:46 UTC (permalink / raw)
To: LM Sensors, LKML; +Cc: greg
On Mon, Jan 31, 2005 at 09:50:50PM +0100, Jean Delvare wrote:
> Hi Adrian,
Hi Jean,
>...
> > -/* match always succeeds, as we want the probe() to tell if we really
> > accept this match */ -static int i2c_device_match(struct device *dev,
> > struct device_driver *drv) -{
> > - return 1;
> > -}
> > -
> > -static int i2c_bus_suspend(struct device * dev, pm_message_t state)
> > -{
> > - int rc = 0;
> > -
> > - if (dev->driver && dev->driver->suspend)
> > - rc = dev->driver->suspend(dev,state,0);
> > - return rc;
> > -}
> > -
> > -static int i2c_bus_resume(struct device * dev)
> > -{
> > - int rc = 0;
> > -
> > - if (dev->driver && dev->driver->resume)
> > - rc = dev->driver->resume(dev,0);
> > - return rc;
> > -}
> > -
> > -struct bus_type i2c_bus_type = {
> > - .name = "i2c",
> > - .match = i2c_device_match,
> > - .suspend = i2c_bus_suspend,
> > - .resume = i2c_bus_resume,
> > -};
> > -
> > static int __init i2c_init(void)
> > {
> > int retval;
>
> Is moving that code around really necessary? Looks to me like only the
> i2c_bus_type structure needs to be moved.
i2c_bus_type requires i2c_device_match, i2c_bus_suspend and
i2c_bus_resume...
> Thanks,
> Jean Delvare
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] i2c-core.c: make some code static
2005-01-31 21:46 ` Adrian Bunk
@ 2005-01-31 22:04 ` Jean Delvare
0 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2005-01-31 22:04 UTC (permalink / raw)
To: Adrian Bunk; +Cc: sensors, linux-kernel, greg
Hi Adrian,
> > > -struct bus_type i2c_bus_type = {
> > > - .name = "i2c",
> > > - .match = i2c_device_match,
> > > - .suspend = i2c_bus_suspend,
> > > - .resume = i2c_bus_resume,
> > > -};
> > (...)
> >
> > Is moving that code around really necessary? Looks to me like only
> > the i2c_bus_type structure needs to be moved.
>
> i2c_bus_type requires i2c_device_match, i2c_bus_suspend and
> i2c_bus_resume...
Oops, seems I missed the obvious here :/
Sorry for the noise. I guess I better get some sleep now...
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] i2c-core.c: make some code static
2005-01-31 18:59 [2.6 patch] i2c-core.c: make some code static Adrian Bunk
2005-01-31 20:50 ` Jean Delvare
@ 2005-02-01 8:18 ` Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2005-02-01 8:18 UTC (permalink / raw)
To: Adrian Bunk; +Cc: phil, sensors, linux-kernel
On Mon, Jan 31, 2005 at 07:59:55PM +0100, Adrian Bunk wrote:
> This patch makes some needlessly global code static.
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-01 8:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-31 18:59 [2.6 patch] i2c-core.c: make some code static Adrian Bunk
2005-01-31 20:50 ` Jean Delvare
2005-01-31 21:46 ` Adrian Bunk
2005-01-31 22:04 ` Jean Delvare
2005-02-01 8:18 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox