Skip to content

Commit 54ba9ac

Browse files
acyrCalcProgrammer1
authored andcommitted
Remove unnecessary context creation from ADL I2C controller
1 parent 6709fe4 commit 54ba9ac

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

i2c_smbus/i2c_smbus_amdadl.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ i2c_smbus_amdadl::i2c_smbus_amdadl(ADL_CONTEXT_HANDLE context)
118118
this->pci_device = dev_id;
119119
this->pci_subsystem_vendor = sbv_id;
120120
this->pci_subsystem_device = sbd_id;
121+
this->port_id = 1;
121122
strcpy(this->device_name, "AMD ADL");
122123
}
123124
}
@@ -139,13 +140,6 @@ s32 i2c_smbus_amdadl::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int s
139140
pI2C->iOffset = command;
140141
pI2C->pcData = (char*)data;
141142

142-
143-
if (ADL_OK != ADL2_Main_Control_Create(::ADL_Main_Memory_Alloc, 1, &context))
144-
{
145-
printf("Cannot get handle!\n");
146-
return ADL_ERR;
147-
}
148-
149143
if (ADL_OK != ADL2_Adapter_Primary_Get(context, &PrimaryDisplay))
150144
{
151145
printf("Cannot get Display!\n");
@@ -173,7 +167,8 @@ s32 i2c_smbus_amdadl::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int s
173167
break;
174168

175169
case I2C_SMBUS_BLOCK_DATA:
176-
return -1;
170+
pI2C->iDataSize = data->block[0];
171+
pI2C->pcData = (char*)&data->block[1];
177172
break;
178173

179174
default:
@@ -203,8 +198,6 @@ s32 i2c_smbus_amdadl::i2c_xfer(u8 addr, char read_write, int* size, u8* data)
203198

204199
bool i2c_smbus_amdadl_detect()
205200
{
206-
int adl_status;
207-
int gpu_count = 0;
208201
ADL_CONTEXT_HANDLE context;
209202

210203
if(ADL_OK == LoadLibraries())

0 commit comments

Comments
 (0)