Skip to content

Commit 00ad391

Browse files
committed
Clean formatting just with tabs
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 27d50a4 commit 00ad391

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

gpu_cfg_generator.c

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
enum power_state {
1616
/* Steady states */
1717
POWER_G3 = 0, /*
18-
* System is off (not technically all the way into G3,
19-
* which means totally unpowered...)
20-
*/
18+
* System is off (not technically all the way into G3,
19+
which means totally unpowered...)
20+
*/
2121
POWER_S5, /* System is soft-off */
2222
POWER_S4, /* System is suspended to disk */
2323
POWER_S3, /* Suspend; RAM on, processor is asleep */
@@ -261,11 +261,11 @@ void dump_ssd(struct default_ssd_cfg* ssd_cfg)
261261
void read_eeprom(const char * infilename)
262262
{
263263
FILE *fptr;
264-
fptr = fopen(infilename,"rb");
264+
fptr = fopen(infilename,"rb");
265265
// TODO: gpu_cfg is bigger than ssd_cfg, that's why I read it into there.
266266
// Should make it safer so that if we change the structures, the same still holds.
267-
fread((void *)&gpu_cfg, sizeof(gpu_cfg), 1, fptr);
268-
fclose(fptr);
267+
fread((void *)&gpu_cfg, sizeof(gpu_cfg), 1, fptr);
268+
fclose(fptr);
269269

270270
uint32_t len = gpu_cfg.descriptor.descriptor_length + sizeof(struct gpu_cfg_descriptor);
271271
// TODO: Length comparison won't work if newer versions of the descriptors have different sizes
@@ -283,7 +283,7 @@ void read_eeprom(const char * infilename)
283283
void program_eeprom(const char * serial, struct gpu_cfg_descriptor * descriptor, size_t len, const char * outpath)
284284
{
285285
crc_t crc;
286-
FILE *fptr;
286+
FILE *fptr;
287287
printf("generating EEPROM\n");
288288
memset(descriptor->serial, 0x00, GPU_SERIAL_LEN);
289289
strncpy(descriptor->serial, serial, GPU_SERIAL_LEN);
@@ -298,79 +298,79 @@ void program_eeprom(const char * serial, struct gpu_cfg_descriptor * descriptor,
298298

299299
printf("writing EEPROM to %s\n", outpath);
300300

301-
fptr = fopen(outpath,"wb");
302-
fwrite(descriptor, len, 1, fptr);
303-
fclose(fptr);
301+
fptr = fopen(outpath,"wb");
302+
fwrite(descriptor, len, 1, fptr);
303+
fclose(fptr);
304304

305305
}
306306

307307
int main(int argc, char *argv[]) {
308308
int gpuflag = 0;
309-
int ssdflag = 0;
310-
char *serialvalue = NULL;
311-
char *pcbvalue = NULL;
312-
char *outfilename = "eeprom.bin";
313-
char *infilename = NULL;
314-
int c;
315-
316-
opterr = 0;
317-
318-
while ((c = getopt (argc, argv, "gds:p:o:i:")) != -1)
319-
switch (c)
320-
{
321-
case 'g':
322-
gpuflag = 1;
323-
break;
324-
case 'd':
325-
ssdflag = 1;
326-
break;
327-
case 's':
328-
serialvalue = optarg;
329-
break;
330-
case 'p':
331-
pcbvalue = optarg;
332-
break;
333-
case 'o':
334-
outfilename = optarg;
335-
break;
336-
case 'i':
337-
infilename = optarg;
338-
break;
339-
case '?':
340-
if (optopt == 'c')
341-
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
342-
else if (isprint (optopt))
343-
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
344-
else
345-
fprintf (stderr,
346-
"Unknown option character `\\x%x'.\n",
347-
optopt);
348-
return 1;
349-
default:
350-
abort ();
351-
}
352-
printf("Build: %s %s\n", __DATE__, __TIME__);
309+
int ssdflag = 0;
310+
char *serialvalue = NULL;
311+
char *pcbvalue = NULL;
312+
char *outfilename = "eeprom.bin";
313+
char *infilename = NULL;
314+
int c;
315+
316+
opterr = 0;
317+
318+
while ((c = getopt (argc, argv, "gds:p:o:i:")) != -1)
319+
switch (c)
320+
{
321+
case 'g':
322+
gpuflag = 1;
323+
break;
324+
case 'd':
325+
ssdflag = 1;
326+
break;
327+
case 's':
328+
serialvalue = optarg;
329+
break;
330+
case 'p':
331+
pcbvalue = optarg;
332+
break;
333+
case 'o':
334+
outfilename = optarg;
335+
break;
336+
case 'i':
337+
infilename = optarg;
338+
break;
339+
case '?':
340+
if (optopt == 'c')
341+
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
342+
else if (isprint (optopt))
343+
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
344+
else
345+
fprintf (stderr,
346+
"Unknown option character `\\x%x'.\n",
347+
optopt);
348+
return 1;
349+
default:
350+
abort ();
351+
}
352+
printf("Build: %s %s\n", __DATE__, __TIME__);
353353

354354
if (infilename) {
355355
read_eeprom(infilename);
356356
return 0;
357357
}
358358

359-
printf("Descriptor Version: %d %d\n", 0, 1);
359+
printf("Descriptor Version: %d %d\n", 0, 1);
360360

361-
printf ("gpu = %d, ssd = %d, module SN = %s pcb SN = %s output file = %s\n",
362-
gpuflag, ssdflag, serialvalue, pcbvalue, outfilename, infilename);
361+
printf ("gpu = %d, ssd = %d, module SN = %s pcb SN = %s output file = %s\n",
362+
gpuflag, ssdflag, serialvalue, pcbvalue, outfilename, infilename);
363363

364-
if (gpuflag) {
365-
if (pcbvalue) {
366-
strncpy(gpu_cfg.pcba_serial.serial, pcbvalue, GPU_SERIAL_LEN);
367-
}
368-
program_eeprom(serialvalue, (void *)&gpu_cfg, sizeof(gpu_cfg), outfilename);
369-
}
364+
if (gpuflag) {
365+
if (pcbvalue) {
366+
strncpy(gpu_cfg.pcba_serial.serial, pcbvalue, GPU_SERIAL_LEN);
367+
}
368+
program_eeprom(serialvalue, (void *)&gpu_cfg, sizeof(gpu_cfg), outfilename);
369+
}
370370

371-
if (ssdflag) {
372-
program_eeprom(serialvalue, (void *)&ssd_cfg, sizeof(ssd_cfg), outfilename);
373-
}
371+
if (ssdflag) {
372+
program_eeprom(serialvalue, (void *)&ssd_cfg, sizeof(ssd_cfg), outfilename);
373+
}
374374

375375
return 0;
376376
}

0 commit comments

Comments
 (0)