-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for SFF_8472/SFP+ standard #20
Open
lguohan
wants to merge
1
commit into
sonic-net:master
Choose a base branch
from
lguohan:sfp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,71 @@ | ||
Update SFF8436 EEPROM driver | ||
Support newer kernel and remove eeprom_class dependency in sff_8436_eeprom | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
From: Shuotian Cheng <[email protected]> | ||
|
||
Support newer kernel and remove eeprom_class dependency | ||
--- | ||
drivers/misc/eeprom/sff_8436_eeprom.c | 27 +++++++-------------------- | ||
include/linux/i2c/sff-8436.h | 2 -- | ||
2 files changed, 7 insertions(+), 22 deletions(-) | ||
drivers/misc/eeprom/sff_8436_eeprom.c | 16 ++-------------- | ||
include/linux/i2c/sff-8436.h | 2 -- | ||
2 files changed, 2 insertions(+), 16 deletions(-) | ||
|
||
diff --git a/drivers/misc/eeprom/sff_8436_eeprom.c b/drivers/misc/eeprom/sff_8436_eeprom.c | ||
index 0b6bf31..f5627bf 100644 | ||
index 3be14d2..bf321a6 100644 | ||
--- a/drivers/misc/eeprom/sff_8436_eeprom.c | ||
+++ b/drivers/misc/eeprom/sff_8436_eeprom.c | ||
@@ -82,7 +82,6 @@ | ||
@@ -85,7 +85,6 @@ | ||
#include <linux/of.h> | ||
#include <linux/i2c.h> | ||
#include <linux/i2c/sff-8436.h> | ||
-#include <linux/eeprom_class.h> | ||
|
||
#include <linux/types.h> | ||
#include <linux/memory.h> | ||
@@ -116,7 +115,6 @@ struct sff_8436_data { | ||
@@ -130,7 +129,6 @@ struct sff_8436_data { | ||
unsigned num_addresses; | ||
|
||
u8 data[SFF_8436_EEPROM_SIZE]; | ||
- struct eeprom_device *eeprom_dev; | ||
|
||
struct i2c_client *client[]; | ||
}; | ||
@@ -421,10 +419,9 @@ static ssize_t sff_8436_eeprom_write(struct sff_8436_data *sff_8436, const char | ||
{ | ||
struct i2c_client *client = sff_8436->client[0]; | ||
struct i2c_msg msg; | ||
- ssize_t status; | ||
unsigned long timeout, write_time; | ||
unsigned next_page; | ||
- int i = 0; | ||
+ int status, i = 0; | ||
|
||
/* write max is at most a page */ | ||
if (count > sff_8436->write_max) | ||
@@ -528,7 +525,7 @@ static ssize_t sff_8436_eeprom_update_client(struct sff_8436_data *sff_8436, | ||
page = sff_8436_translate_offset(sff_8436, &phy_offset); | ||
|
||
dev_dbg(&client->dev, | ||
- "sff_8436_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%d, opcode:%d\n", | ||
+ "sff_8436_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%zu, opcode:%d\n", | ||
off, page, phy_offset, count, opcode); | ||
if (page > 0) { | ||
ret = sff_8436_write_page_reg(sff_8436, page); | ||
@@ -705,18 +702,18 @@ static ssize_t sff_8436_read_write(struct sff_8436_data *sff_8436, | ||
pending_len = pending_len - page_len; | ||
|
||
dev_dbg(&client->dev, | ||
- "sff_read off %lld len %d page_start_offset %lld page_offset %lld page_len %d pending_len %d\n", | ||
+ "sff_read off %lld len %zu page_start_offset %lld page_offset %lld page_len %zu pending_len %zu\n", | ||
off, len, page_start_offset, page_offset, page_len, pending_len); | ||
|
||
/* Refresh the data from offset for specified len */ | ||
ret = sff_8436_eeprom_update_client(sff_8436, page_offset, page_len, opcode); | ||
if (ret != page_len) { | ||
if (err_timeout) { | ||
- dev_dbg(&client->dev, "sff_8436_update_client for %s page %d page_offset %lld page_len %d failed %d!\n", | ||
+ dev_dbg(&client->dev, "sff_8436_update_client for %s page %d page_offset %lld page_len %zu failed %d!\n", | ||
(page ? "Upper" : "Lower"), (page ? (page-1) : page), page_offset, page_len, ret); | ||
goto err; | ||
} else { | ||
- dev_err(&client->dev, "sff_8436_update_client for %s page %d page_offset %lld page_len %d failed %d!\n", | ||
+ dev_err(&client->dev, "sff_8436_update_client for %s page %d page_offset %lld page_len %zu failed %d!\n", | ||
(page ? "Upper" : "Lower"), (page ? (page-1) : page), page_offset, page_len, ret); | ||
} | ||
} | ||
@@ -780,15 +777,13 @@ static ssize_t sff_8436_macc_write(struct memory_accessor *macc, const char *buf | ||
/* Config variable to support SFF-8472/SFP+ standard */ | ||
int sfp_compat; | ||
@@ -955,7 +953,7 @@ static ssize_t sff_8436_macc_write(struct memory_accessor *macc, | ||
|
||
/*-------------------------------------------------------------------------*/ | ||
|
||
-static int __devexit sff_8436_remove(struct i2c_client *client) | ||
+static int sff_8436_remove(struct i2c_client *client) | ||
{ | ||
struct sff_8436_data *sff_8436; | ||
|
||
sff_8436 = i2c_get_clientdata(client); | ||
sysfs_remove_bin_file(&client->dev.kobj, &sff_8436->bin); | ||
int i; | ||
@@ -967,8 +965,6 @@ static int __devexit sff_8436_remove(struct i2c_client *client) | ||
for (i = 1; i < sff_8436->num_addresses; i++) | ||
i2c_unregister_device(sff_8436->client[i]); | ||
|
||
- eeprom_device_unregister(sff_8436->eeprom_dev); | ||
- | ||
kfree(sff_8436->writebuf); | ||
kfree(sff_8436); | ||
return 0; | ||
@@ -821,7 +816,6 @@ static int sff_8436_eeprom_probe(struct i2c_client *client, | ||
@@ -1050,7 +1046,6 @@ static int sff_8436_eeprom_probe(struct i2c_client *client, | ||
|
||
chip.setup = NULL; | ||
chip.context = NULL; | ||
- chip.eeprom_data = NULL; | ||
} | ||
|
||
if (!is_power_of_2(chip.byte_len)) | ||
@@ -923,13 +917,6 @@ static int sff_8436_eeprom_probe(struct i2c_client *client, | ||
if (err) | ||
@@ -1182,13 +1177,6 @@ static int sff_8436_eeprom_probe(struct i2c_client *client, | ||
dev_err(&client->dev, "failed to create sysfs attribute group.\n"); | ||
goto err_struct; | ||
|
||
- sff_8436->eeprom_dev = eeprom_device_register(&client->dev, chip.eeprom_data); | ||
} | ||
- sff_8436->eeprom_dev = eeprom_device_register(&client->dev, | ||
- chip.eeprom_data); | ||
- if (IS_ERR(sff_8436->eeprom_dev)) { | ||
- dev_err(&client->dev, "error registering eeprom device.\n"); | ||
- err = PTR_ERR(sff_8436->eeprom_dev); | ||
- goto err_sysfs_cleanup; | ||
- } | ||
- | ||
i2c_set_clientdata(client, sff_8436); | ||
|
||
dev_info(&client->dev, "%zu byte %s EEPROM, %s\n", | ||
@@ -968,7 +955,7 @@ static struct i2c_driver sff_8436_driver = { | ||
@@ -1235,7 +1223,7 @@ static struct i2c_driver sff_8436_driver = { | ||
.owner = THIS_MODULE, | ||
}, | ||
.probe = sff_8436_eeprom_probe, | ||
|
@@ -139,3 +94,6 @@ index cd46896..4df48ad 100644 | |
}; | ||
|
||
#endif /* _LINUX_SFF_8436_H */ | ||
-- | ||
2.7.4 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated? Please split it out into a separate commit with an explanation.