at25.c (688d794c4c3f8b08c814381ee2edd3ede5856056) | at25.c (41ddcf67b864343690bffd8029a882377c3ff50b) |
---|---|
1/* 2 * at25.c -- support most SPI EEPROMs, such as Atmel AT25 models 3 * 4 * Copyright (C) 2006 David Brownell 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 398 unchanged lines hidden (view full) --- 407 if (!(at25 = kzalloc(sizeof *at25, GFP_KERNEL))) { 408 err = -ENOMEM; 409 goto fail; 410 } 411 412 mutex_init(&at25->lock); 413 at25->chip = chip; 414 at25->spi = spi_dev_get(spi); | 1/* 2 * at25.c -- support most SPI EEPROMs, such as Atmel AT25 models 3 * 4 * Copyright (C) 2006 David Brownell 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 398 unchanged lines hidden (view full) --- 407 if (!(at25 = kzalloc(sizeof *at25, GFP_KERNEL))) { 408 err = -ENOMEM; 409 goto fail; 410 } 411 412 mutex_init(&at25->lock); 413 at25->chip = chip; 414 at25->spi = spi_dev_get(spi); |
415 dev_set_drvdata(&spi->dev, at25); | 415 spi_set_drvdata(spi, at25); |
416 at25->addrlen = addrlen; 417 418 /* Export the EEPROM bytes through sysfs, since that's convenient. 419 * And maybe to other kernel code; it might hold a board's Ethernet 420 * address, or board-specific calibration data generated on the 421 * manufacturing floor. 422 * 423 * Default to root-only access to the data; EEPROMs often hold data --- 34 unchanged lines hidden (view full) --- 458 kfree(at25); 459 return err; 460} 461 462static int at25_remove(struct spi_device *spi) 463{ 464 struct at25_data *at25; 465 | 416 at25->addrlen = addrlen; 417 418 /* Export the EEPROM bytes through sysfs, since that's convenient. 419 * And maybe to other kernel code; it might hold a board's Ethernet 420 * address, or board-specific calibration data generated on the 421 * manufacturing floor. 422 * 423 * Default to root-only access to the data; EEPROMs often hold data --- 34 unchanged lines hidden (view full) --- 458 kfree(at25); 459 return err; 460} 461 462static int at25_remove(struct spi_device *spi) 463{ 464 struct at25_data *at25; 465 |
466 at25 = dev_get_drvdata(&spi->dev); | 466 at25 = spi_get_drvdata(spi); |
467 sysfs_remove_bin_file(&spi->dev.kobj, &at25->bin); 468 kfree(at25); 469 return 0; 470} 471 472/*-------------------------------------------------------------------------*/ 473 474static struct spi_driver at25_driver = { --- 14 unchanged lines hidden --- | 467 sysfs_remove_bin_file(&spi->dev.kobj, &at25->bin); 468 kfree(at25); 469 return 0; 470} 471 472/*-------------------------------------------------------------------------*/ 473 474static struct spi_driver at25_driver = { --- 14 unchanged lines hidden --- |