Skip to content
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

[platform][as9726-32d] Fix wrong serial and model name in psu driver #11178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <linux/delay.h>
#include <linux/dmi.h>

#define MAX_MODEL_NAME 20
#define MAX_MODEL_NAME 12
#define MAX_SERIAL_NUMBER 19

static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf);
Expand Down Expand Up @@ -282,8 +282,8 @@ static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *d
psu_present = (data->status >> (data->index) & 0x1); //0:present, 1:not present

if (!psu_present) {
status = as9726_32d_psu_read_block(client, 0x20, data->model_name,
ARRAY_SIZE(data->model_name)-1);
status = as9726_32d_psu_read_block(client, 0x21, data->model_name,
ARRAY_SIZE(data->model_name)-1);
if (status < 0) {
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr);
Expand All @@ -294,14 +294,15 @@ static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *d

}
/* Read from offset 0x35 ~ 0x46 (18 bytes) */
status = as9726_32d_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER);
status = as9726_32d_psu_read_block(client, 0x3A,data->serial_number,
ARRAY_SIZE(data->serial_number)-1);
if (status < 0)
{
data->serial_number[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr);
printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr);
}
data->serial_number[MAX_SERIAL_NUMBER-1]='\0';
data->serial_number[ARRAY_SIZE(data->serial_number)-1]='\0';
}

data->last_updated = jiffies;
Expand Down