Changeset 5202

Show
Ignore:
Timestamp:
04/24/08 14:22:59 (7 years ago)
Author:
khali
Message:

Move print_i2c_busses from i2cbusses.c to i2cdetect.c, as it is
only used there.

Location:
i2c-tools/trunk/tools
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/tools/i2cbusses.c

    r5200 r5202  
    5656}; 
    5757 
    58 struct i2c_adap { 
    59         int nr; 
    60         char *name; 
    61         const char *funcs; 
    62         const char *algo; 
    63 }; 
    64  
    6558static enum adt i2c_get_funcs(int i2cbus) 
    6659{ 
     
    10093} 
    10194 
    102 static void free_adapters(struct i2c_adap *adapters) 
     95void free_adapters(struct i2c_adap *adapters) 
    10396{ 
    10497        int i; 
     
    129122} 
    130123 
    131 static struct i2c_adap *gather_i2c_busses(void) 
     124struct i2c_adap *gather_i2c_busses(void) 
    132125{ 
    133126        char s[120]; 
     
    295288} 
    296289 
    297 /* 
    298  * Print the installed i2c busses. The format is those of Linux 2.4's 
    299  * /proc/bus/i2c for historical compatibility reasons. 
    300  */ 
    301 void print_i2c_busses(void) 
    302 { 
    303         struct i2c_adap *adapters; 
    304         int count; 
    305  
    306         adapters = gather_i2c_busses(); 
    307         if (adapters == NULL) { 
    308                 fprintf(stderr, "Error: Out of memory!\n"); 
    309                 return; 
    310         } 
    311  
    312         for (count = 0; adapters[count].name; count++) { 
    313                 printf("i2c-%d\t%-10s\t%-32s\t%s\n", 
    314                         adapters[count].nr, adapters[count].funcs, 
    315                         adapters[count].name, adapters[count].algo); 
    316         } 
    317  
    318         free_adapters(adapters); 
    319 } 
    320  
    321290static int lookup_i2c_bus_by_name(const char *bus_name) 
    322291{ 
  • i2c-tools/trunk/tools/i2cbusses.h

    r5200 r5202  
    2323#define _I2CBUSSES_H 
    2424 
    25 void print_i2c_busses(void); 
     25struct i2c_adap { 
     26        int nr; 
     27        char *name; 
     28        const char *funcs; 
     29        const char *algo; 
     30}; 
     31 
     32struct i2c_adap *gather_i2c_busses(void); 
     33void free_adapters(struct i2c_adap *adapters); 
    2634 
    2735int lookup_i2c_bus(const char *i2cbus_arg); 
  • i2c-tools/trunk/tools/i2cdetect.c

    r5201 r5202  
    159159} 
    160160 
     161/* 
     162 * Print the installed i2c busses. The format is those of Linux 2.4's 
     163 * /proc/bus/i2c for historical compatibility reasons. 
     164 */ 
     165static void print_i2c_busses(void) 
     166{ 
     167        struct i2c_adap *adapters; 
     168        int count; 
     169 
     170        adapters = gather_i2c_busses(); 
     171        if (adapters == NULL) { 
     172                fprintf(stderr, "Error: Out of memory!\n"); 
     173                return; 
     174        } 
     175 
     176        for (count = 0; adapters[count].name; count++) { 
     177                printf("i2c-%d\t%-10s\t%-32s\t%s\n", 
     178                        adapters[count].nr, adapters[count].funcs, 
     179                        adapters[count].name, adapters[count].algo); 
     180        } 
     181 
     182        free_adapters(adapters); 
     183} 
     184 
    161185int main(int argc, char *argv[]) 
    162186{